Home > Article > Backend Development > How to convert time to text in php
In PHP, time can be converted to text through the strtotime function. The function of this function is to parse the date and time description of any string into a Unix timestamp, and the timestamp is an encrypted voucher document.
The operating environment of this article: windows7 system, PHP7.1 version, DELL G3 computer
How does php realize time conversion to text?
can be converted through the strtotime function.
The strtotime() function parses any string datetime description into a Unix timestamp (number of seconds since January 1 1970 00:00:00 GMT).
Note: If the year representation uses a two-digit format, values 0-69 will be mapped to 2000-2069, and values 70-100 will be mapped to 1970-2000.
Note: Please note that for dates in m/d/y or d-m-y format, if the separator is a slash (/), the American m/d/y format is used. If the delimiter is a dash (-) or a dot (.), the European d-m-y format is used. To avoid potential errors, you should use YYYY-MM-DD format whenever possible or use the date_create_from_format() function.
Syntax
int strtotime ( string $time [, int $now = time() ] )
Parameters
time is required. Specifies a date/time string.
now Optional. Specifies the timestamp used to calculate the return value. If this parameter is omitted, the current time is used.
Related introduction:
The timestamp refers to 00:00:00 on January 1, 1970, Greenwich Mean Time (01 Beijing time, 1970 The total number of seconds from 08:00:00 on month 01 to now. In layman's terms, a timestamp is a piece of complete and verifiable data that represents the existence of a piece of data at a specific point in time.
It is mainly proposed to provide users with an electronic evidence to prove the time when some of the user's data was generated. In practical applications, it can be used in all aspects including e-commerce and financial activities, and can especially be used to support the "non-repudiation" service of public key infrastructure.
Time-stamp (time-stamp) is an encrypted credential document, which includes three parts:
1. Digest of the file to be timestamped;
2. The date and time DTS receives the file;
3. DTS’s digital signature.
Recommended learning: "PHP Video Tutorial"
The above is the detailed content of How to convert time to text in php. For more information, please follow other related articles on the PHP Chinese website!