A Scripting Language for Web, Linux and Windows

A Scripting Language for Web, Linux and Windows

Date/Time functions

The following date and time functions are supported.

Function/Arguments Return Description
time () number Return the GMT/UTC timestamp in seconds from January 1, 1970.
date (string format [, number timestamp]) string Format a timestamp to a readable local date format. Date formats are described in table below. If parameter timestamp is not given then the current time from function time() is used. On success the formatted date/time is returned, otherwise the formatted date 1970-01-01 00:00:00 is returned.
gmdate (string format [, number timestamp]) string Format a timestamp to a readable GMT/UTC date format. Arguments are the same as in date() function. The difference is, that the timezone is GMT/UTC instead of the local timezone. The difference between local timezone and GMT/UTC in seconds can be determined with date ("%Z")
mktime ([number hour, number minute, number second, number month, number day, number year]) number Return a local timestamp created from the optional parameters. If parameters are not set then the values of current time are used. For example: mktime (19,30) will create the timestamp 19:30 o'clock of the current day.
microtime (bool asFloat=false) number Return the timestamp in microseconds since start of the system. If parameter asFloat = true then the time will be returned as seconds in floating point format.
easter_date (number year) number Return the timestamp of Easter date of the given year.

Date formats:

Description date() format option Value (example)
Day of month with leading 0 %d 04
Day of month without leading 0 %j 4
Name of weekday short %D Fri
Name of weekday long %l Friday
Numerical day of week (0 =Sunday, 6 = Satureday) %w 5
Day of year beginning from 1 %z 124
Calendar week beginning from 1 %W 18
Name of month long %F May
Name of month short %M May
Number of month with leading 0 %m 05
Number of month without leading 0 %n 5
Maximal days of month %t 31
Leap year (1 = yes, 0 = no) %L 0
Year with 4 digits %Y 2018
Year with 2 digits %y 18
Lower case: Ante meridiem (Forenoon) or Post meridiem (Afternoon) %a am
Upper case: Ante meridiem (Forenoon) or Post meridiem (Afternoon) %A AM
Hour in 12 hour format without leading 0 %g 9
Hour in 24 hour format without leading 0 %G 19
Hour in 12 hour format with leading 0 %h 09
Hour in 24 hour format with leading 0 %H 19
Minute with leading 0 %i 08
Second with leading 0 %s 04
Time difference to Greenwich time (GMT/UTC) in hours %O +0200
Time difference to Greenwich time (GMT/UTC) in hours with double point %P +02:00
Time difference of the system timezone to GMT/UTC in seconds %Z 7200
Is date in summer time (1 = yes, 0 = no) %I 1
Name of the system timezone %e Western European Summer Time

back to Home

V1 Version 0.95 - Documentation generated Sun, 02 Dec 2018 16:29