Convert date from dd/mm/yyyy and get last date of month

For selecting converting var char to date.

and replace with last date of the month of the date

 DECLARE @vdt nvarchar(MAX)='2/2014'
  

  
  --select CONVERT(date,'1/'+@vdt,103)

  
  select CAST(dateadd(month,1+datediff(month,0,
  CONVERT(date,'1/'+@vdt,103)
  
  ),-1) as DATE)

CATEGORIES:

Tags:

No Responses

Leave a Reply

Your email address will not be published. Required fields are marked *