In order to use time functions you must install one language dictionary.
timer_start & timer
Use these functions to get the execution time of your application.
timer_start() // start the timer
// ... execute your code here
echo timer() // get the passed time
// ... execute your code here
echo timer() // get the passed time
time_format
Convert timestamp to readable format. You can format the time as string with the same syntax of strftime.
time_format( $timestamp, "%d %B" ) // output 20 December
You can use time format into template as modifier, to format date variable:
{$news.date|time_format} // output Dec 26 2010
You can use time constants as format preset:
| Time constants | Output (en) |
| DATE_FORMAT (default) | Dec 15 2010 |
| TIME_FORMAT | 20:30 |
| DATE_TIME_FORMAT | Dec 15 2010 20:30 |
| MONTH_FORMAT | Dec 2010 |
time_elapsed
It shows the timestamp in a time passed format. Useful for printing the last reply on a forum. Same as time_format it is very useful to format template date variable.
time_elapsed( $timestamp ) // output 3 minutes ago
sec_to_hms
Converts seconds to HH:MM:SS
sec_to_hms( 3000 ) // output 00:50:00
sec_to_string
Convert seconds to string. It's necessary to include one language dictionary to works propertly.
sec_to_string( 3000 ) // output "50 minutes"
