Home > Article > Backend Development > Detailed explanation of the differences between time(), date(), and mktime() in php
Example 2:
Reference gmdate() mktime() strftime Format the server's time locally. Syntax: string strftime(string format, int [timestamp]); Return value: string Function type: time date Content Description The string of the return value is determined by the configured format. If there is a timestamp value passed in, the timestamp will be formatted and returned; if there is no timestamp value passed in, the time of the current server will be formatted locally and returned. The month or day of the week name changes depending on the locale configuration setlocale(). The returned string can be in the following format:
Refer to setlocale() mktime() getdate Get time and date information. Syntax: array getdate(int timestamp); Return value: array Function type: time date Content Description The elements of the returned array include the following items: "seconds" - seconds "minutes" - minutes "hours" - hours "mday" - the day of the month "wday" - the day of the week "mon" - month number "year" - year, number "yday" - the day of the year; such as: "299" "weekday" - the full name of the day of the week; e.g.: "Friday" "month" - the full name of the month; such as: "January"gettimeofday Get the current time. Syntax: array gettimeofday(void); Return value: array Function type: time date Content Description The elements of the returned array include the following items: "sec" - seconds "usec" - millionths of a second "minuteswest" - Minutes in Greenwich Mean Time "dsttime" - the destination time zonegmdate Get the current time difference from GMT. Syntax: string gmdate(string format, int timestamp); Return value: string Function type: time date Content Description This function is similar to the date() function, except that this function returns the time difference from Greenwich Mean Time (GMT) 1 2 Next page Last page |