Welcome Tour
Site Checklist
Our Story




The time command can be used to do various time conversions. It can also track the number of days until (due) or since a specified time.

This command looks first for the when parameter, then the value of parameter 1. It can be a timestamp, or a time expression that PHP understands (using strtotime). If no valid time is found, the current time is used. PHP can recognize a pretty amazing variety of time expressions.

The fmt is defined by the fmt parameter, or the second parameter, or even the first parameter. If no fmt is found it uses the timeFmt config value as set in site.config, or the default value of %c (which returns a date and time string). It can take any value PHP understands (using strftime) and can output about any time expression you would want.

To use this function effectively it is helpful to know a bit about timestamps and PHP works with them. Here are links to some info on time expressions and time formatting at the PHP site.

BoltWire make a few minor additions to what is normally available in PHP to make up for a couple weaknesses and to add a little extra functionality.

fmt=due will return the number of days until the specified time
fmt=since will return the number of days since the specified time
fmt=timestamp of fmt=%s will cause the command to return a timestamp.
%e in the fmt is replaced with the day of the month without a leading 0
%E in the fmt is replaced with the number for the month without a leading 0

Here's a simple example of how the function works:

Outputs the current time, default format (Fri May 24 00:53:22 2024)

<(time 'Next Thursday')>
Returns next Thursday, in the default format (Thu May 30 00:00:00 2024)

<(time '%Y-%E-%e')>
Returns the current time in a custom fmt (2024-5-24)

<(time '+2 hours' '%H:%M:%S')>
Returns the time in two hours (02:53:22)

<(time 'March 31, 2015' fmt=due)>
How many days until the specified date (Tue Mar 31 00:00:00 2015)

<(time '01/01/2000' fmt=since)>
How many days since the specified date (Fri May 24 00:53:22 2024)

Time Zones

The time functions in PHP are set to use Greenwich Mean Time (GMT) which may not be what you want to use for you installation. BoltWire has the ability to set your local time zone. Just set localTime in site.config to the number of hours difference between your zone and GMT. This site is set on "localTime: 6" for Central Standard Time. In the USA, use the following:

EST - 5
CST - 6
MST - 7
PST - 8