How to convert php timestamp to t format: 1. Create a php sample file; 2. Use the "date('Y-m-dTH:i:sZ', 1547740800);" method or "date( 'c',1547740800);" method can convert unix timestamp to UTC.
The operating environment of this tutorial: Windows 10 system, PHP8.1, Dell G3 computer.
How to convert php timestamp to t format?
PHP converts UNIX timestamp UTC time (TZ format) Standard time method UNIX UTC GMT time and local time conversion
We often encounter various differences in PHP programming Format time
For example:
unix时间戳:1547740800 UTC时间:2019-1-18T00:00:00Z 标准时间:2019-1-18 00:00:00
The above three time formats all represent 0:00 on January 18, 2019 Minutes and seconds, how to convert these three time formats in PHP? Here we will teach you
1. Convert UNIX to UTC
echo date('Y-m-dTH:i:sZ', 1547740800); //输出:2019-1-18T00:00:00Z
or
echo date('c',1547740800); //输出:2019-1-18T00:00:00Z+02:00
2. Convert UNIX to standard time
echo date('Y-m-d H:i:s', 1547740800); //输出:2019-1-18 00:00:00
3. Convert UTC to standard time
$utc='2019-1-18T00:00:00Z'; $unix= str_replace(array('T','Z'),' ',$utc); echo $unix; //输出:2019-1-18 00:00:00
4. Convert UTC to UNIX timestamp
$utc='2019-1-18T00:00:00Z'; $time= str_replace(array('T','Z'),' ',$utc); $unix=strtotime($time); echo $unix; //输出:1547740800
5. Convert standard time to UNIX timestamp
$time='2019-1-18 00:00:00'; $unix=strtotime($time); echo $unix; //输出:1547740800
6. Convert standard time to UTC time
$time='2019-1-18 00:00:00'; $unix=strtotime($time); $utc=date('Y-m-dTH:i:sZ', $unix); echo $utc; //输出:2019-1-18T00:00:00Z
Recommended learning: "PHP Video Tutorial"
The above is the detailed content of How to convert php timestamp to t format. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

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

Hot Article

Hot Tools

SAP NetWeaver Server Adapter for Eclipse
Integrate Eclipse with SAP NetWeaver application server.

MinGW - Minimalist GNU for Windows
This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

Zend Studio 13.0.1
Powerful PHP integrated development environment

ZendStudio 13.5.1 Mac
Powerful PHP integrated development environment

mPDF
mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),
