Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how to convert these two dates?

Status
Not open for further replies.

childrenfirst

Technical User
Oct 15, 2006
80
US
Hi,

I have a table and every row of record has a column called ImportDate for timestamp in format like 2006-12-08 15:47:27.717.

I created a query to convert timestamp into short date, but did not get the result I wanted. My query:

SELECT RecordID, SelectDate = (CONVERT(varchar,SelectDate,101)
FROM Records

I would like to convert the timestamp to 12/8/2006 instead of 12/08/2006.

Any advice will be greatly appreciated!!

 
If the field have DateTime type what you see is a matter ONLY for a visual representation. DateTime field is not stored in the table as '12/08/...' it is stored as number of days passed since 01/01/1900 in integer part of the field, time part of the datetime is number of seconds passed since midnight in decimal part (If I remember well what gmmastros said :)).

Borislav Borissov
VFP9 SP1, SQL Server 2000/2005.
MVP VFP
 
If you want a specific format for the date, then it would be best to do it in a front end application.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top