Downloaded 802 times
PHP date() for GM
Converts dates to strings
Downloads
Please read the Help tab for instructions.
|
v1.1
(gmd; 0.01 MB)
|
|
v1.1
(gml; 0.01 MB)
|
Links to here:
Description
Game Maker contains the functions date_datetime_string(), date_date_string() and date_time_string(), but it does not have a function to convert a date-time value to a custom format. That's where this script comes in, which uses the same format as the PHP function
date(). Except for the timezone related characters and the full date/time characters, everything is supported. Because of known precision problems in Game Maker 6, the date and time must be passed as separate date-time values. (the time is optional)
Version 1.1 (stable)
Release date: 25 July 2006
Language: Dutch
System requirements: Game Maker 5.3a or later (also works in Lite/unregistered edition)
- Script now in download
- Example/text added
- Documentation on formatting characters added
Version 1.0 (stable)
Release date: 4 March 2006
Language: Dutch
System requirements: Game Maker 5.3a or later (also works in Lite/unregistered edition)
Project status
A stable version of this product has been released.
The project was announced at 4 March 2006.
Credits
This script has been created by Jeroen van der Gun. It is highly appreciated to mention this in the credits of your game.
More for Game Maker
Comments
No comments have been posted yet. Use the form to post one.
Help
Syntax
date_string(format,date)
date_string(format,date,time)
Returns the notation of the as date-time values provided date (and time), following the specified format. You can create the format using the characters from the documentation below.
Supported formatting characters
Special:
\ Escaper, show next character litterally
Days:
d Day of the month, with zerofill (01-31)
D Day of the week, textual and abbreviated (Mon-Sun)
j Day of the month, without zerofill (1-31)
l (small L) Day of the week, textual and long (Monday-Sunday)
N Day of the week, numeric starting with Monday (Mon=1, Sun=7)
S Postfix for ordinal number of day of the month (st, nd, rd, th)
w Day of the week, numeric starting with Sunday (Sun=0, Sat=6)
z Day of the year, 1 January is zero (0-365)
Weeks:
W Week of the year, starting with Monday (1-52)
Months:
F Month, textual and long (January-December)
m Month, numeric with zerofill (01-12)
M Month, textual and abbreviated (Jan-Dec)
n Month, numeric without zerofill (1-12)
t Number of days in month (28-31)
Years:
L Leep year, boolean (0=no, 1=yes)
o Year according to week number, long (bijv. 2006)
Y Year according to date, long (bijv. 2006)
y Year according to date, abbreviated (bijv. 06)
Hours:
a Ante Meridiem or Post Meridiem, lowercase (am, pm)
A Ante Meridiem or Post Meridiem, uppercase (AM, PM)
g Hour, 12-hours without zerofill (1-12)
G Hour, 24-hours without zerofill (0-23)
h Hour, 12-hours with zerofill (01-12)
H Hour, 24-hours with zerofill (00-23)
Minutes:
i Minute, with zerofill (00-59)
Seconds:
s Second, with zerofill (00-59)