[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Re: best way to get epoch seconds from mysql datetime value

Aleksandar Lazic

11/11/2006 5:53:00 PM

Hi,

On Son 12.11.2006 01:32, shawn bright wrote:
>Hey there all,
>
>if i have a mysql datetime value that looks like this:
>some_time = '2006-05-11 05:14:14'
>
>and i want to get seconds since the unix epoch, how would i go about
>that ?

If you have the possibility to use mysql why not to use the builtin
function:

UNIX_TIMESTAMP(date)

from http://www.mysql.org/doc/refman/4.1/en/date-and-time-func...

Due the fact that I don't know which version of mysql you use I have
looked into the lowest possible version ;-)

Hth

Aleks

1 Answer

Aleksandar Lazic

11/11/2006 6:20:00 PM

0

On Son 12.11.2006 03:12, shawn bright wrote:
>i suppose i could use that, i am working with mysql 5 ( oh, the luxury)
>i am just not that knowledgeable with it.

http://www.mysql.org/doc/refman/5.0/en/date-and-time-func...

Same there => UNIX_TIMESTAMP(date)

Hth

Aleks