Jun 22, 2004 #1 sardinka2 Programmer May 6, 2004 38 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 Oct 2, 2003 182 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 May 24, 2004 99 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