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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Dumb date question of the day....

Status
Not open for further replies.

simian336

Programmer
Sep 16, 2009
723
US
Ok, I am sure this is a format question but it would be nice to know how to set it.

This question came from a user, so... If I right click on a file with a date field and choose OPEN TABLE I get a date with the format:

10/26/1999 12:00:00 AM

If I choose

select mydate
from file

then I get a date in the format

2012-02-03 00:00:00.000

Any idea why the format is different and how to change it.

Thanks

Simi

 
no clue about the why's but i recently had to do a query where the datetime had to be returned in a very particular format. I came across this url:
it shows all the different examples of datetime display and the magic number that you put in

so yours may be Select CONVERT(mydate, 0)
 
Don't CONVERT date.
How you see the date is just a representation. It is NOT how the date is kept into the table.
So you can check SET DATEFORMAT in BOL. If you want to see the date in SSMS formatted as you want.
But if you develop an application then handle the date by your frontend.

Borislav Borissov
VFP9 SP2, SQL Server 2000,2005 & 2008.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top