Stupid newbie time question
Posted in 2000
Topics: Migration, Import/Export & Data Conversion
I'm trying to get a date and time out of one of our tables that is stored in unix times (seconds since a given date). Is there a simple way to do this as part of the sql statement? right now I'm unloading it to a a file, then reading it in and using itod to convert it but would rather do it all in one statement. Any help would be appreciated. -- Wil Odom wil0@netscape.net
Wil Odom wrote: > > I'm trying to get a date and time out of one of our tables that is > stored in unix times (seconds since a given date). > > Is there a simple way to do this as part of the sql statement? right > now I'm unloading it to a a file, then reading it in and using itod to > convert it but would rather do it all in one statement. > > Any help would be appreciated. > > -- > Wil Odom > wil0@netscape.net What about: select datetime(YYYY-MM-DD 00:00:00) year to second + col_where_time_is_seconds units second from WhateverTable where YYYY-MM-DD is the 'starting' date. -- John Carlson Informix DBA WHSmith USA #include std_disclaimer.h /* These are my opinions, not my company's opinion */
Thanks! I'm playing with it right now. I'm assuming the YYY-MM-DD is the "zero" time for unix, I think 1970-01-01. "Carlson@WHSmith" wrote: > Wil Odom wrote: > > > > I'm trying to get a date and time out of one of our tables that is > > stored in unix times (seconds since a given date). > > > > Is there a simple way to do this as part of the sql statement? right > > now I'm unloading it to a a file, then reading it in and using itod to > > convert it but would rather do it all in one statement. > > > > Any help would be appreciated. > > > > -- > > Wil Odom > > wil0@netscape.net > > What about: > > select datetime(YYYY-MM-DD 00:00:00) year to second + > col_where_time_is_seconds units second > from WhateverTable > > where YYYY-MM-DD is the 'starting' date. > > -- > John Carlson > Informix DBA > WHSmith USA > > #include std_disclaimer.h /* These are my opinions, not my company's > opinion */ -- Wil Odom wil0@netscape.net eFax: (707) 982-1846 C-Phone: (954) 461-5314
Wil Odom wrote: > > Thanks! I'm playing with it right now. I'm assuming the YYY-MM-DD is the > "zero" time for unix, I think 1970-01-01. That's correct. You said in your message that it was seconds since a 'given date'. I didn't want to assume 1/1/70. BTW, the only 'stupid newbie question' is the unasked question. Always feel free to ask; if the answer's in the manual, you'll be directed there. > > "Carlson@WHSmith" wrote: > > > Wil Odom wrote: > > > > > > I'm trying to get a date and time out of one of our tables that is > > > stored in unix times (seconds since a given date). > > > > > > Is there a simple way to do this as part of the sql statement? right > > > now I'm unloading it to a a file, then reading it in and using itod to > > > convert it but would rather do it all in one statement. > > > > > > Any help would be appreciated. > > > > > > -- > > > Wil Odom > > > wil0@netscape.net > > > > What about: > > > > select datetime(YYYY-MM-DD 00:00:00) year to second + > > col_where_time_is_seconds units second > > from WhateverTable > > > > where YYYY-MM-DD is the 'starting' date. > > > > -- > > John Carlson > > Informix DBA > > WHSmith USA > > > > #include std_disclaimer.h /* These are my opinions, not my company's > > opinion */ > > -- > Wil Odom > wil0@netscape.net > eFax: (707) 982-1846 > C-Phone: (954) 461-5314 -- John Carlson Informix DBA WHSmith USA #include std_disclaimer.h /* These are my opinions, not my company's opinion */