Jun 22, 2004 #1 sardinka2 Programmer Joined May 6, 2004 Messages 38 Location US From I query I have a data returning back as: 9/1/2004 12:00:00 AM I would like to get only date without time.what function should I use.
From I query I have a data returning back as: 9/1/2004 12:00:00 AM I would like to get only date without time.what function should I use.
Jun 22, 2004 #2 john76 MIS Joined Oct 2, 2003 Messages 182 Location US You can use the CONVERT function to change the datetype to varchar, then apply the style of your choice. Code: SELECT CONVERT(varchar, MyDateField, 101) FROM MyTable This example of the 101 syle returns mm/dd/yyyy format. HTH, John Upvote 0 Downvote
You can use the CONVERT function to change the datetype to varchar, then apply the style of your choice. Code: SELECT CONVERT(varchar, MyDateField, 101) FROM MyTable This example of the 101 syle returns mm/dd/yyyy format. HTH, John
Jun 22, 2004 #3 jmk418 MIS Joined May 24, 2004 Messages 99 Location US hi you can use the left function to pull back the number of characters from the left that you need or use the convert function to pull back the date left("field name", (number of characters) convert(varchar (10), "field name", style) style 101 returns the date as mm/dd/yyyy jeremy Upvote 0 Downvote
hi you can use the left function to pull back the number of characters from the left that you need or use the convert function to pull back the date left("field name", (number of characters) convert(varchar (10), "field name", style) style 101 returns the date as mm/dd/yyyy jeremy