vendredi 1 janvier 2016

Want to print todays date with month and year

I want to get today's Month and date by the below query, but I am getting something as

Jul 21 1905 12:00AM

I want it as

Dec 31 2015

below is my query

declare @actualMonth int 
  declare @actualYear int
set  @actualYear = 2015
set @actualMonth = 12
 DECLARE @DATE DATETIME
SET @DATE = CAST(@actualYear +'-' + @actualMonth AS datetime) 
 print  @DATE

what is wrong here

Aucun commentaire:

Enregistrer un commentaire