PHP strptime () function tutorial
Definitions and usage
The strptime () function resolves a time/date generated strptime ().
This function returns an array of date profiling. The key to return the array is:
[Tm_sec]-SEC (0-61)
[Tm_min]-min (0-59)
[Tm_hour]-hours (0-23)
[Tm_mday]-the first day of one months (1-31)
[Tm_mon]-months since 1st (0-11)
[Tm_year]-since 1 900 years
[Tm_wday]-days Sunday (0-6)
[Tm_yday]-days January 1 (0-365)
[Non-resolution]-The date part, does not recognize the use of the specified format, if any
Grammar
Strptime (Date,format)
The parameter description date must be filled in. String profiling (such as returning it will ()) require formatting. Specify the format used in the date:%-weekday name abbreviation%-Full weekday name% B-month name abbreviation% B group-full one month name% c Group-preferred date and time representative% c Group-century Number (divided by 1 00 a year) from 0 0 to 9 9)% d-one months from the first day (0 1st to 3 1st)% d-same% m/% d/% y%-one-month first day (1st to 3 1st)% grams-such as%, but no century of political-4 digits a year corresponding I so weeks (see%, V). % h-same% B% h-hours, use 2 4 hour clock (0 0 to 2 3rd)% i-hour, use 1 2-hour clock (0 1 to 1 2)% geometry-one-day year (0 01 to 3 66)% m-month (0 1 to 1 2)% m.-min%ñ-line breaks , p-value-whether it is the morning or afternoon according to the value of a specific time% gas turbine-time in the morning and afternoon symbol% gas turbine-time in 2 4 hour Add% s-second pen-tab% Pen-current time, equals%:% s% u-Weekday as a number (1 to 7), Monday = 1. Warning: in Sun's Solaris Sunday = 1 U-weeks the first Sunday of the year began as% five-the first week of the first day (0 1 to 5 3) in the 8 601 weeks of the year the first week of 1 weeks has been at least 4 days in the current year, with the first day of Monday, week % men and women-weeks of the beginning of the year, the first Monday as the first day of the first week% Watt-week as a decimal, Sunday = 0%-Preferred Date representative time%-the preferred time does not represent the date% y-year one century (from 0 0 to 9 9)% Y-one year, including century%ž or% groceries-when Area or name or abbreviation%-literal% hint and note Note: This feature is not executed on the Windows platform. --------------------------------------------------------------------------------For example These two examples, strftime () and Strptime (): <?php
$format = "%d/%m/%y%h:%m:%s";
$STRF =strftime ($format);
Echo ("$STRF");
Print_r (Strptime ($STRF, $format));
?> output results. 03/10/2005 13:23:44
Array
(
[Tm_sec] => 44
[Tm_min] => 23
[Tm_hour] => 13
[Tm_mday] => 3
[Tm_mon] => 9
[Tm_year] => 105
[Tm_wday] => 0
[Tm_yday] => 276
[unparsed] =>
)