time

Description

Returns a timestamp.

 integer time( [ string input [, integer now ]] )

When called with no parameters, returns the current UNIX timestamp (the number of seconds since January 1 1970 00:00:00 GMT).

When a string input parameter is passed, attempts to convert the string to a timestamp, in a manner similar to (but not identical to) PHP’s strtotime function.

If a timestamp (in milliseconds) is passed to the now parameter, it uses that value as a basis for calculating relative times.

The time() function’s input function is quite generous and understands combinations of formats such as the following:

 "Jan 31, 2012" "1/31/12" "January 31" "3:32 PM" "15:32:00" "3 PM"

You can apply relative times using + or -like so:

 "+60 minutes" "-3 hours" "+2 weeks" "+6 months" "-1 year"

These relative times are applied relative to the nowparameter.

You can get the next available day of the week by passing a weekday name, for instance:

 "+2 weeks Wednesday 3 PM"

Will return the Wednesday following two weeks from the current date, at 3 PM.

Examples

{if profile.click_time > time("-4 weeks")} 
   This user has clicked within the past four weeks 
{/if}
Top