|
|
||||||
|
#1
|
|
|
|
|
I've been running the following to convert SQL time into Unix time:
select DATEDIFF(s, '19700101', end_date), end_date, start_date, event_sub_type, courseid from training.dbo.classes where courseid like 'HLH 110.R031%' However, it isn't taking into account the timezone - I need the unix timestamp to take into account Eastern Time (GMT -5) so that when translated taking into account timezone it comes out as such. For example, given the SQL timestamp 2010-01-14 my script returns 1263427200 (when translated as GMT this is Jan 14, but with the -5 for ET, it comes out to Jan 13) but I need it to return something like 1263445200 (which with the -5 for ET, comes out to Jan 14)... any ideas on how to do this in SQL? I only need to run it once. |
|
|
|
#2
|
|
|
|
|
You can add the 5 hours with DATEADD:
SELECT DATEDIFF(s, '19700101', DATEADD(HOUR, 5, end_date)), end_date, start_date, event_sub_type, courseid FROM training.dbo.classes WHERE courseid LIKE 'HLH 110.R031%'; |
|
#3
|
|
|
|
|
So easy and clean! Perfect! Thanks!
|
|
|
| Similar Threads | |
| Convert to Unix Timestamp Hello How can I convert a date into the Unix timestamp? I don't really mind what format the date is in, something like MMDDYY would be fine, can someone show me what code I... |
|
| how to convert date to unix timestamp Hello, I am looking for way to convert date i.e. "Fri Feb 23 06:13:55 EST 2007" to unix time stamp? Does any one know a library which could be help full? Regards, Fibre... |
|
| Convert unix timestamp to date('Y-m-d H:i:s')? How do you convert a unix timestamp to date('Y-m-d H:i:s')? |
|
| How To Convert Unix TimeStamp Is there a formula to convert the Unix timestamp to a real date & time to put in a Crystal Report? Thanks, Vicki |
|
| Convert unix timestamp to postgres timestamp I'm writting a little calendar script and I need to insert a pair of start and end timestamps into a postgres database table. These are in unix format (seconds since 1st Jan... |
|
|
All times are GMT. The time now is 09:46 AM. | Privacy Policy
|