UNIX timestamp UTC GMT time localtime

Greenwich Mean Time (GMT)
Region: Royal Greenwich Observatory

Time zone: UTC / GMT 0 (zero area)

Beijing Time difference: GMT is now eight hours later than Beijing

Greenwich is located in the south bank of the Thames, and North Shore towns through tunnels and roads. 1423 Henry, Duke of Gloucester Trick built around Greenwich Park, on the banks of the hills Tzu watchtower built, and later built the Greenwich Royal Observatory.

Coordinated Universal Time (UTC)
, ie Greenwich mean solar time at UTC Coordinated Universal Time, Greenwich standard time means the location, but also represents a form of the Earth's rotation rate, based on International Atomic Time UTC.
Quote from http://www.beijing-time.org/time15.asp

UTC GMT and so there is no difference, but the two terms have some conventional scenarios. UTC time generally will refer to the normal time, when not including the concept of zones, GMT generally will be used in the expression time zones, such as Beijing time zone is GMT +. 8
the UNIX timestamp (time_t time (time_t *) return time) using UTC time is from 1970-1-1 0:00:00 to now the number of seconds, so if a simple mathematical calculation (but do not repeat create the wheel, following the localtime function can give you a good conversion, but note some details), and Beijing (our local time) difference is 8 hours, Beijing time is calculated to +8, which is GMT + 8.
Incidentally, localtime can be obtained from the local time_t time (has helped us add a good number of the time zone difference), but to +1970 year, a few months to +1, because time is counted from the beginning of 1970, the month of it, is counted from 0, corresponding to 0 in January, the corresponding 11 December. Novice should pay special attention.

end!

Guess you like

Origin www.cnblogs.com/d-dream/p/11293795.html