This chapter describes common date functions and frequently encountered scenarios for processing date and time, such as calculating the difference between two time periods, and briefly introduces the date display problem between different time zones. I personally think this can be ignored in the astronomical calendar computing aspects. Strftime (): Set setlocal () according to the region to format the time day
This chapter describes common date functions and frequently encountered date/time processing scenarios, such as calculating the difference between two time periods, and briefly introduces the date display problem between different time zones. I personally think this can be ignored in the astronomical calendar computing aspects. Strftime (): Set the setlocal () format time/day based on the region
This chapter introducesDateCommon functions and frequently encountered ProcessingDate/TimeSuch as computing twoTimeAnd briefly introducesDateShow the problem. I personally think this can be ignored in the astronomical calendar computing aspects.
Strftime (): Set setlocal () format based on the regionTime/Date
Date (): A localDate/Time
Getdate (): GetDate/Time(You can specifyTimeStamp)
Return array from getdate ()
Key |
Value |
Seconds |
Seconds |
Minutes |
Minutes |
Hours |
Hours |
Mday |
Day of the month |
Wday |
Day of the week, numeric (Sunday is 0, Saturday is 6) |
Mon |
Month, numeric |
Year |
Year, numeric (4 digits) |
Yday |
Day of the year, numeric (e.g., 299) |
Weekday |
Day of the week, textual, full (e.g., "Friday ") |
Month |
Month, textual, full (e.g., "January ") |
0 |
Seconds since epoch (whatTime ()Returns) |
Localtime (): returnsTime
Return array from localtime ()
Numeric position |
Key |
Value |
0 |
Tm_sec |
Second |
1 |
Tm_min |
Minutes |
2 |
Tm_hour |
Hour |
3 |
Tm_mday |
Day of the month |
4 |
Tm_mon |
Month of the year (January is 0) |
5 |
Tm_year |
Years since1900 |
6 |
Tm_wday |
Day of the week (Sunday is 0) |
7 |
Tm_yday |
Day of the year |
8 |
Tm_isdst |
Is daylight savings time in effect? |
Mktime (): Get oneDateUnixTimeTimestamp, with six parameters: hour, minute, second, month, day, and year
Gmmktime (): Get GMTDateUnixTimeTimestamp
Gregoriantojd)
Checkdate (): VerifyDateValid or not (for example, April 31 is an errorDate)
Date_default_timezone_set (): sets the default time zone for the script.
Microtime (): returns UnixTimeTimestamp and microsecond, used to calculate program runningTimeThis method is commonly used.
Cal_from_jd (): converts the Julian Day count to a supported calendar (ignore)
Cal_to_jd (): Convert from a supported calendar to a Julian Day count (ignore)
Gregoriantojd (): transforming a Gregorian CalendarDateCount to Julian Day (ignore)
Date_Calc (): Calendar extension class of pear
Putenv (): With localtime (), you can set an environment variable for the time zone to obtain the localTime(Solve the problem that the server and the visitor are not in the same time zone)
DateSeconds of variance $ diff_seconds = $ epoch_1-$ epoch_2; // days of variance $ diff_days = floor ($ diff_seconds/86400);?>
Julian day (JD) refers to the number of days that have elapsed since noon in the Coordinated Universal Time on January 1, January 1, 4713 BC. It is mostly used by astronomy as a single calendar of astronomy, unify the year tables of different calendars. If the calculation is separated by several yearsDateThe number of days between them is more convenient.