Re: UNIX Timestamp

Ralf Bast <[email protected]> Thu, 02 Aug 2007 23:16:42 +0200
Newsgroups gmane.comp.db.maxdb
Message-ID <[email protected]>
--------------020107070101090706050702
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 8bit

Hi Elke,
thank you very much for your work.
My original problem was that I wanted to convert a Unix timestamp to a 
database date. Just in order to do calculations within SQL (DATEDIFF, ...)

A unix timstamp it the milliseconds since 1970-01-01 .
In normal case I store timestamps  in a fixed(13) so its good for 
arithmetical calculations.

If I now divide these Unix timestamp by the amount of milliseconds of 
one day (86400000)the result will be the amount of days since 
1970-01-01. And in the second step I add them to the date it self. As 
result I got a date within the database. Now I'm ready for any further 
calculations.

This was long time a problem for me, but tomorrow morning i got this idea :D

I hope things  make more sense to you now.

Regards / Gruß
Ralf Bast

Zietlow, Elke schrieb:
> Hi,
>
> For an unknown reason I did not receive your original mail, but only this one, with your 'solution'.
> And I have no idea which problem could be solved with this 'solution'.
>
> To explain the problem:
>
> timestamp is a character-value looking like a number
> --> dividing it is very uncommon
>
> timestamp includes year, month, day, hour, minute, second and MICROSECOND.
> 86400000 is the number of MILLISECONDs of a day.
>
> Even assuming that we do not use 86400000, but 86400000000,
> for the division of now '20070802103215123456' and this value my calculator tells me something about
> 232300950,...... (many digits in the fractional part)
>
> And you use this result as number of days, meaning some day in the year 636440.
>
> Sorry, but this cannot be what you really want 
>
>   Elke
> SAP Labs Berlin
>  
> Sitz der Gesellschaft/Registered Office: Walldorf, Germany
>
> Vorstand/SAP Executive Board: Henning Kagermann (Sprecher/CEO), Léo Apotheker, Werner Brandt, Claus Heinrich, Gerhard Oswald, Peter Zencke
>
> Vorsitzender des Aufsichtsrats/Chairperson of the SAP Supervisory Board: Hasso Plattner
>
> Registergericht/Commercial Register Mannheim No HRB 350269
>
> Diese E-Mail kann Betriebs- oder Geschäftsgeheimnisse oder sonstige vertrauliche Informationen enthalten. Sollten Sie diese E-Mail irrtümlich erhalten haben, ist Ihnen eine Kenntnisnahme des Inhalts, eine Vervielfältigung oder Weitergabe der E-Mail ausdrücklich untersagt.
>
> Bitte benachrichtigen Sie uns und vernichten Sie die empfangene E-Mail. Vielen Dank.
>
> This e-mail may contain trade secrets or privileged, undisclosed, or otherwise confidential information. If you have received this e-mail in error, you are hereby notified that any review, copying, or distribution of it is strictly prohibited. Please inform us immediately and destroy the original transmittal. Thank you for your cooperation. 
>
>  
>
>   
>> -----Original Message-----
>> From: Ralf Bast [mailto:[email protected]] 
>> Sent: Donnerstag, 2. August 2007 08:48
>> To: [email protected]
>> Subject: [LIKELY JUNK]UNIX Timestamp
>>
>> Hi,
>> this problem has been solved.
>> I think i got a solution:
>>
>> ADDDATE('1970-01-01',timestamp / 86400000)
>>
>> Just a bit to fast posted.
>>
>> Regards
>> Ralf
>>
>> ______________________________________________________________
>> ___________
>> In 5 Schritten zur eigenen Homepage. Jetzt Domain sichern und 
>> gestalten! 
>> Nur 3,99 EUR/Monat! http://www.maildomain.web.de/?mc=021114
>>
>>
>> -- 
>> MaxDB Discussion Mailing List
>> For list archives: http://lists.mysql.com/maxdb
>> To unsubscribe:    
>> http://lists.mysql.com/[email protected]
>>
>>
>>     
>
>   


--------------020107070101090706050702--