SakhaliaNetHome PageMilitary HistoryVorKutaAcceptance of cookiesAcceptance of cookies

PHP Tutorial :: Reference (II)

Reference of PHP

Format characters for strftime() and date()



Type strftime() date() Description Range Windows?
Hour %H H Hour, numeric, 24h clock 00-23 Yes
Hour %I h Hour, numeric, 12h clock 01-12 Yes
Hour %K Hour, numeric, 24h clock, initial 0 as space 0-23 No
Hour %l Hour, numeric, 24h clock, initial 0 as space 1-12 No
Hour %p A A.M. or P.M., according to local use Yes
Hour %P a a.m. or p.m., according to local use No
Hour G Hour, numeric, 24h clock, initial 0 suppressed 0-23 No
Hour g Hour, numeric, 12h clock, initial 0 suppressed 0-11 No
Minute %M i Minute, numeric 00-59 Yes
Second %S s Second, numeric 00-61 * Yes
Day %d d Day of the month, numeric 01-31 Yes
Day %e Day of the month, numeric, initial 0 as space 1-31 No
Day %j z Day of the year, numeric 001-366 for strftime(), 001-365 for date() Yes
Day %u Day of the week, numeric, starting by Monday 1-7 No
Day %w w Day of the week, numeric, starting by Sunday 0-6 Yes
Day j Day of the month, numeric, initial 0 suppressed 1-31 No
Day S English sufix for day of the month "st", "nd", "rd", "th" No
Week %a D Name of the week, shortened, according to local use Yes
Week %A l Name of the week, according to local use Yes
Week %U Number of week on the year, numeric, the first Sunday is the first day of the first week 00-53 Yes
Week %V Name of the week on the year, numeric, the first week is the first one that has at least four days in the current year, Monday is the first day of the week 01-53 No
Week %W Name of the week on the year, numeric, the first Monday is the first day of the first week 00-53 Yes
Month %B F Name of the month, according to local use Yes
Month %b M Name of the month, shortened, according to local use Yes
Month %h Name of the month, shortened, according to local use No
Month %m m Month, numeric 01-12 Yes
Month n Month, numeric, initial 0 suppressed 1-12 No
Month t Duration of the month in days, numeric 28-31 No
Year %C Century, numeric 00-99 No
Year %g Four digits year, numeric 00-99 No
Year %G Four digits year with century, numeric 00-99 No
Year %y y Year, numeric 00-99 Yes
Year %Y Y Year with century, numeric Yes
Year L Indication of leap-year 0-1 No
Timezone %z O GMT timezone, +/-HHMM (-1200)-(+1200) Yes, but like %Z
Timezone %Z T Timezone, textual Yes
Timezone I Indication of Daylight Saving Time 0-1 No
Timezone Z Seconds set according to GMT (negative to the west, positive to the east) (-43200)-(+43200) No
Compound %c Standard date-time Yes
Compound %D Same as %m/%d/%y No
Compound %F Same as %Y-%m-%d No
Compound %r Hour as A.M. or P.M. notation, according to local use No
Compound %R Hour as 24 hours notation, according to local use No
Compound %T Hour as 24 hours notation, same as %H:%M:%S No
Compound %x Standard date format, according to local use Yes
Compound %X Standard time format, according to local use Yes
Compound r Date formatted such as "Thu, 21 Dec 2000 16:01:07 +0200" No
Other %s U Seconds since the epoch No
Other B Change to internet date No
Format %% % character as verbatim Yes
Format %n New line character No
Format %t Tabulation character No

* The range reaches 61 to justify the seconds of leap-years

Reference of PHP

File modes for fopen()



Mode Allowed actions Starting point Content erasing If file doesn't exists...
rb Read Beginning No Sends warning and returns false
rb+ Read/Write Beginning No Sends warning and returns false
wb Write Beginning Yes Tries to create the file
wb+ Read/Write Beginning Yes Tries to create the file
ab Write End No Tries to create the file
ab+ Read/Write End No Tries to create the file
xb Write Beginning No Tries to create the file. If the file exists, sends warning and returns false
xb+ Read/Write Beginning No Tries to create the file. If the file exists, sends warning and returns false