search
HomeBackend DevelopmentPHP ProblemHow 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.

How to convert time to text in php

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!

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

EditPlus Chinese cracked version

EditPlus Chinese cracked version

Small size, syntax highlighting, does not support code prompt function

SublimeText3 English version

SublimeText3 English version

Recommended: Win version, supports code prompts!

MantisBT

MantisBT

Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

SublimeText3 Linux new version

SublimeText3 Linux new version

SublimeText3 Linux latest version

SecLists

SecLists

SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.