Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
FGlock
Starting Member
3 Posts |
Posted - 2005-09-26 : 13:29:15
|
| The dates in the SQL database look like this:open_date109576848710957039301126727859I would like to know how to convert the date into something usable. For instance, the 3rd value is really 9/14/2005. I'm using Query Analyzer.Thanks for any guidance you might provide. |
|
|
SamC
White Water Yakist
3467 Posts |
Posted - 2005-09-26 : 14:37:38
|
| What is the data type of open_date ? DATETIME, VARCHAR, INT ? |
 |
|
|
Kristen
Test
22859 Posts |
Posted - 2005-09-26 : 14:54:21
|
| Hi FGlock, Welcome to SQL Team!Are these Unix "seconds since 01-Jan-1970"?if so I would do:select dateadd(second, open_date, '19700101')Kristen |
 |
|
|
FGlock
Starting Member
3 Posts |
Posted - 2005-09-26 : 15:17:30
|
quote: Originally posted by Kristen Hi FGlock, Welcome to SQL Team!Are these Unix "seconds since 01-Jan-1970"?if so I would do:select dateadd(second, open_date, '19700101')Kristen
|
 |
|
|
FGlock
Starting Member
3 Posts |
Posted - 2005-09-26 : 15:21:09
|
| Kristen - I want to thank you so much. The code sample you sent me worked beautifully. I have been struggling with this for many hours trying to glean what I could from others' postings, but nothing I tried seemed to work. I am a mainframe person (used to JCL and batch jobs) so this is a new world for me doing online queries in the server world. Thanks again and have a great day!By the way, the date shows as Int, Null in the listing in Query Analyzer. |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2005-09-27 : 01:04:49
|
>>Are these Unix "seconds since 01-Jan-1970"?Kris, how did you find that? Is 01-Jan-1970 mimimum date in Unix?MadhivananFailing to plan is Planning to fail |
 |
|
|
Kristen
Test
22859 Posts |
Posted - 2005-09-27 : 03:12:12
|
| We "pull" some data from an Oracle application which seems to favour storing dates as "seconds since 01-Jan-1970".The numbers looked about the right size!Kristen |
 |
|
|
|
|
|
|
|