December 13, 2005 at 6:13 am
Hi,
I have a table with a field with epoch time value.
How can I convert it to a Date/Time like dd/mm/yyyy hh:mm:ss ?
Thank you
December 13, 2005 at 7:11 am
SELECT DATEADD(s,[epochcolumn],'19700101')
assuming that your 'Date Zero' is 01/01/1970
Far away is close at hand in the images of elsewhere.
Anon.
December 13, 2005 at 7:32 am
Sounds of applause!!!
Now do you have anything for the required formatting other than concatenation ?!?!
<pre class="code"
SELECT convert(varchar, DATEADD(s, epochCol,'19700101'), 103) + ' '
+ convert(varchar, DATEADD(s, epochCol,'19700101'), 108)
AS formattedDate
**ASCII stupid question, get a stupid ANSI !!!**
December 13, 2005 at 7:43 am
Excellent, working fine 🙂
December 13, 2005 at 8:16 am
![]() | Now do you have anything for the required formatting other than concatenation ?!?! |
STUFF(CONVERT(varchar,DATEADD(s, epochCol,'19700101'),120),1,10,CONVERT(char(10),DATEADD(s, epochCol,'19700101'),103))
Far away is close at hand in the images of elsewhere.
Anon.
December 13, 2005 at 9:11 am
An alternative certainly - but not quite the elegant minimalistic solution that I've come to expect from you...
just goes to show that a pedestal is a very precarious place to be on...never know when you can topple..
**ASCII stupid question, get a stupid ANSI !!!**
December 13, 2005 at 9:30 am
![]() | but not quite the elegant minimalistic solution... |
Workmen (or should it be workpersons ) hate to blame their tools but.....
![]() | a pedestal is a very precarious place to be.... |
Yeah, but your on the pedestal aren't you
I would soar like an Eagle to try to reach you but... Turkey's can't fly
Far away is close at hand in the images of elsewhere.
Anon.
December 13, 2005 at 9:44 am
NO NO D.Burrows - YOU are on the pedestal - I put you there (along with several others I'm sure...) - now you just need to make sure you stay put...tools or no tools-
**ASCII stupid question, get a stupid ANSI !!!**
December 13, 2005 at 10:14 am
Far away is close at hand in the images of elsewhere.
Anon.
December 13, 2005 at 10:36 am
whatever happened to the restrained sangfroid that the Brits are famous for ?! Must be the influence of those people across the channel!!!!
**ASCII stupid question, get a stupid ANSI !!!**
Viewing 10 posts - 1 through 10 (of 10 total)
You must be logged in to reply to this topic. Login to reply