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.

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.

eZ debug

Timing: Jan 19 2025 02:36:33
Script start
Timing: Jan 19 2025 02:36:33
Module start 'layout'
Timing: Jan 19 2025 02:36:33
Module start 'content'
Timing: Jan 19 2025 02:36:33
Module end 'content'
Timing: Jan 19 2025 02:36:33
Script end

Main resources:

Total runtime0.0166 sec
Peak memory usage2,048.0000 KB
Database Queries3

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0066 589.4063152.6563
Module start 'layout' 0.00660.0047 742.062539.5078
Module start 'content' 0.01130.0035 781.570393.4922
Module end 'content' 0.01490.0017 875.062538.3047
Script end 0.0166  913.3672 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.002515.1674140.0002
Check MTime0.00116.6480140.0001
Mysql Total
Database connection0.00116.893210.0011
Mysqli_queries0.004627.647530.0015
Looping result0.00000.186410.0000
Template Total0.00148.710.0014
Template load0.00074.389510.0007
Template processing0.00074.240310.0007
Override
Cache load0.00052.803510.0005
General
dbfile0.00021.442680.0000
String conversion0.00000.066040.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 1
 Number of unique templates used: 1

Time used to render debug report: 0.0001 secs