471,887 Members | 1,304 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,887 software developers and data experts.

Converting C++ Unix time_t Julian date to SQL date

I've just been trying to do this. I looked on Google and it seems to
be a common problem with no obvious solution. I've seen various
solutions which don't seem exactly elegant, so I figured I'd post the
solution I came up with. It's effectively a single line solution,
albeit with various embedded calls. It makes an adjustment for the
local timezone too!
SET @time_t = 1090834321 /* 10:32am, July 26th 2004 BST */

SET @timestamp = dateadd (ss, datediff (ss, GetUTCDate(), GetDate()),
dateadd (ss, @time_t, '19700101'))
PRINT @timestamp
Hope that helps. If there's a problem with it, let me know!


Jul 20 '05 #1
0 1794

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Dan Jacobson | last post: by
5 posts views Thread by francescomoi | last post: by
7 posts views Thread by bob | last post: by
3 posts views Thread by Jef Driesen | last post: by
5 posts views Thread by Grey Alien | last post: by
11 posts views Thread by Keith Hughitt | last post: by
reply views Thread by YellowAndGreen | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.