Timestamp other than the current can be achieved in various ways, which must be used according to application.
If there is broken ‚data, that is, in separate variables day, month, year, etc., Or can lead to such a situation by the appropriate use of funkcjiexplode () or substr (), you can use mktime (). This function takes as arguments respectively hour, minute, second, month, day, year.
$day = 10;
$month = 4;
$hour = 12;
$min = 32;
$second = 0;
$ts = mktime ($hour, $min, $sec, $month, $day, $year);
If the date is stored as a string, but in one of the formats recognized by the PHP string can be converted to a timestamp using funkcjistrtotime (). Data consists of several elements, separated by „white space” (space, tab). White space can be skipped if it does not cause any ambiguity. Elements of the date of this part of the calendar, part of the clock, time zone, only the numerical part. The order of the elements does not matter. Two other elements, day and time shift will be described later in this chapter.
This section specifies the particular day of the year. It can be served on one of the many ways.
1970-09-17 #Record complies with ISO 8601.
70-9-17 # default, the current age
70-09-17 # All leading zeros are ignored
24 September 1972
24 Sept 72 # A special shortcut word September
24 Sep 72 # Everywhere are allowed three-letter abbreviations
Sep 24, 1972
20: 02: 0
20: 02-0500 # specifying the time zone
The basic format is hh: mm: ss, where part of the seconds can be omitted. If the end is added pointer am or pm, is part of the hour is limited to a range of 1-12. In this notation midnight to 12am, noon – 12pm.
Optionally, immediately after the time may be given the time zone in the format „zggmm”, where „z” is the appropriate + or – sign, depending on the zone, gg is the number of hours and number of minutes mm offset.
The time zone can be specified as in the case of information „appended” to the part of the clock.
Some of the numerical
The numbers in the form yyyymmdd if you have not been part of the calendar, are treated as those parts. Similarly, the number in the form hhmm is treated as part of the clock, if there was no before.