d2jsp
Log InRegister
d2jsp Forums > Off-Topic > Computers & IT > Programming & Development > Date Format Problem
Add Reply New Topic New Poll
Member
Posts: 8,635
Joined: Dec 28 2007
Gold: 87.00
Mar 20 2014 02:29am
Hi,

I have some database tables I need to get date out of but the date format is odd. Date is stored in integers, but its not unix time. I assume that biggest number in table is for today and the max value is 77879. Any one have idea how to get this to normal date format like '2014-03-20' for today.

Thanks.
Member
Posts: 10,812
Joined: Oct 15 2009
Gold: Locked
Warn: 20%
Mar 20 2014 03:58am
Quote (vittujenkevat @ Mar 20 2014 01:29am)
Hi,

I have some  database tables I need to get date out of but the date format is odd. Date is stored in integers, but its not unix time. I assume that biggest number in table is for today and the max value is 77879. Any one have idea how to get this to normal date format like '2014-03-20' for today.

Thanks.


number of days since 1800-12-28

probably supposed to be number of days since 1801-01-01 and some discrepancy from leap centuries or something. Play with dates in that range and maybe you can get something that works.
Member
Posts: 8,635
Joined: Dec 28 2007
Gold: 87.00
Mar 20 2014 04:25am
Quote (Azrad @ 20 Mar 2014 11:58)
number of days since 1800-12-28

probably supposed to be number of days since 1801-01-01 and some discrepancy from leap centuries or something. Play with dates in that range and maybe you can get something that works.


You are correct. With this statement "DateAdd(day, @Date- 4, '1801-01-01')" we seem to get correct dates. Thanks.
Member
Posts: 8,635
Joined: Dec 28 2007
Gold: 87.00
Mar 20 2014 04:46am
Another column holds time, it is in odd format aswell. Example value is 4515118 and that should be somewhere close to mid day I suppose. Any ideas on that?
Member
Posts: 10,812
Joined: Oct 15 2009
Gold: Locked
Warn: 20%
Mar 20 2014 05:15am
Quote (vittujenkevat @ Mar 20 2014 03:46am)
Another column holds time, it is in odd format aswell. Example value is 4515118 and that should be somewhere close to mid day I suppose. Any ideas on that?


hundreths of a second since midnight? High noon would be 4320000
Member
Posts: 8,635
Joined: Dec 28 2007
Gold: 87.00
Mar 20 2014 06:00am
Quote (Azrad @ 20 Mar 2014 13:15)
hundreths of a second since midnight? High noon would be 4320000


Correct. I tried that before but it didn't work so I thought it cant be that. Had to convert ms to second before using database conversion to make it work. Thanks again.
Go Back To Programming & Development Topic List
Add Reply New Topic New Poll