Hi,
Does anyone know of a quick an easy way of convertiing unix date serials eg
12815 to March 31 2005).
Any pointers appreciated
Thanks
SimonHi
I would have expected
select dateadd(ss, <UNIX_timestamp>, '19700101')
to have worked which implies 12815 either wrong or not a unix timestamp!!
John
"skilla31" wrote:
> Hi,
> Does anyone know of a quick an easy way of convertiing unix date serials e
g
> 12815 to March 31 2005).
> Any pointers appreciated
> Thanks
> Simon
>
>|||I suspect this isn't a standard Unix timestamp. Maybe 12815 represents
the number of days since some date. For example:
DECLARE @.t INTEGER
SET @.t = 12815
SELECT DATEADD(DAY,@.t,'19691231')
Result:
2005-01-31 00:00:00.000
(1 row(s) affected)
or:
SELECT DATEADD(DAY,@.t,'19700228')
Result:
2005-03-31 00:00:00.000
(1 row(s) affected)
DATEADD is probably the function you need in any case.
David Portas
SQL Server MVP
--|||Thanks
Jens, John & David, that solved my problem. Turns out I got the number wrong
should've been 12873
Thanks
Simon
"skilla31" <simon@.ris.org.uk> wrote in message
news:uN56AxOQFHA.3496@.TK2MSFTNGP12.phx.gbl...
> Hi,
> Does anyone know of a quick an easy way of convertiing unix date serials
> eg 12815 to March 31 2005).
> Any pointers appreciated
> Thanks
> Simon
>|||"skilla31" <simon@.ris.org.uk> wrote in message
news:uN56AxOQFHA.3496@.TK2MSFTNGP12.phx.gbl...
> Hi,
> Does anyone know of a quick an easy way of convertiing unix date serials
> eg 12815 to March 31 2005).
SELECT DATEADD(d, 12815, '01 Jan 1970')
Showing posts with label serials. Show all posts
Showing posts with label serials. Show all posts
Sunday, February 19, 2012
converting unix dates
Subscribe to:
Posts (Atom)