Forums / General / How can I set a specific date to get timestamp?? Please help!

How can I set a specific date to get timestamp?? Please help!

Author Message

Ted Striker

Friday 10 September 2004 1:12:00 am

Going mad!

currentdate() will return seconds since 01.01.1970, with this date you can customize a date easily:


currentdate()|datetime('custom',"%H:%G:%s %m/%d/%Y")

this will resturn for 1094750495 seconds -> 19:21:35 09/09/2004, up to current second.

How can I obtain the seconds to a certain date, lets say 01.07.1980 at
00:00? Is it possible?

This task is quite easy in PHP...

TIA

Can you feel it Mr. Anderson? Closing in on you? Oh I can, I really should thank you after all. It was, after all, it was your life that taught me the purpose of all life. Purpose of life is to end.

Paul Borgermans

Friday 10 September 2004 1:54:51 am

Hi

There are (undocumented until now) date and time operators. Like maketime and makedate and gettime :-)

<b>gettime(<timestamp>)</b> returns an associative array with the current elements for the timestamp provided:
'seconds'
'minutes'
'hours'
'day'
'month'
'year'
'weekday'
'yearday'
'epoch'
<b>maketime(<hour>,<minute>,<second>,<month>,<day>,<year>,<dst>)</b>
returns a timestamp
<b>makedate(<month>,<day>,<year>,<dst>)</b>
returns also a timestamp with the hour, minute ans seconds set to 0

hth

-paul

eZ Publish, eZ Find, Solr expert consulting and training
http://twitter.com/paulborgermans

Paul Borgermans

Friday 10 September 2004 2:03:42 am

For completeness of the above:

gettime also operates on an input value if provided (when both are present, it will be the input value too):

{let mydatearr=currentdate|timestamp}

{/let}

-paul

eZ Publish, eZ Find, Solr expert consulting and training
http://twitter.com/paulborgermans

Ted Striker

Friday 10 September 2004 2:23:02 am

Thanks for the info Paul,

I will try your code right now... this functions don't even appear in your book :) I always look there before posting and search the forum as well...

Regarding cross post: sorry, wont happen again, after posting I found my query more suitable for General than to Setup&Design forum, unfortunateley I don't know how to move or delete my own posts, is there such feature?

Thanks again.

Can you feel it Mr. Anderson? Closing in on you? Oh I can, I really should thank you after all. It was, after all, it was your life that taught me the purpose of all life. Purpose of life is to end.

Ted Striker

Friday 10 September 2004 2:27:47 am

Thanks Paul you saved my life :)

 
maketime(<hour>,<minute>,<second>,<month>,<day>,<year>,<dst>)

This function will do the task perfectly!

Can you feel it Mr. Anderson? Closing in on you? Oh I can, I really should thank you after all. It was, after all, it was your life that taught me the purpose of all life. Purpose of life is to end.