DateTime field

  • Thread starter Thread starter Ryan Langton
  • Start date Start date
R

Ryan Langton

Are there any functions to retrieve only the Date from a DateTime field?

Thanks,
Ryan
 
Not sure, but I think that you must extract it in its character format;
something like:

convert (nvarchar (10), MyDateTimeField, 102)

Of course, you can also add a level of conversion to get it back in DateTime
format:

convert (DateTime, convert (DateTime, MyDateTimeField, 102), 102)
Or:
convert (DateTime, convert (DateTime, MyDateTimeField, 102) + '
12:00:00 AM', 102)


There is also the function DatePart (....).
 
Back
Top