Home Backend Development PHP Tutorial Mon Mar 12 10:18:26 +0800 2012 时间格式转换解决方法

Mon Mar 12 10:18:26 +0800 2012 时间格式转换解决方法

Jun 13, 2016 am 10:15 AM
date echo strtotime

Mon Mar 12 10:18:26 +0800 2012 时间格式转换
上面的是个字符串,怎么把那个时间转换成2012-3-12 10:18:26格式 ,用php写的,谢谢啦

------解决方案--------------------
$s='Mon Mar 12 10:18:26 +0800 2012';
echo date('Y-m-d H:i:s',strtotime($s));
------解决方案--------------------
好像可以直接用date转吧,忘记了

$str='Mon Mar 12 10:18:26 +0800 2012';
echo date('Y-m-d G:i:s',strtotime($str));
------解决方案--------------------

探讨

$s='Mon Mar 12 10:18:26 +0800 2012';
echo date('Y-m-d H:i:s',strtotime($s));

------解决方案--------------------
探讨

好像可以直接用date转吧,忘记了

$str='Mon Mar 12 10:18:26 +0800 2012';
echo date('Y-m-d G:i:s',strtotime($str));
Statement of this Website
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 Article Tags

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

How to create and name a file/folder based on current timestamp How to create and name a file/folder based on current timestamp Apr 27, 2023 pm 11:07 PM

How to create and name a file/folder based on current timestamp

PHP Warning: date() expects parameter 2 to be long, string given solution PHP Warning: date() expects parameter 2 to be long, string given solution Jun 22, 2023 pm 08:03 PM

PHP Warning: date() expects parameter 2 to be long, string given solution

Five selected Go language open source projects to take you to explore the technology world Five selected Go language open source projects to take you to explore the technology world Jan 30, 2024 am 09:08 AM

Five selected Go language open source projects to take you to explore the technology world

Go language development essentials: 5 popular framework recommendations Go language development essentials: 5 popular framework recommendations Mar 24, 2024 pm 01:15 PM

Go language development essentials: 5 popular framework recommendations

Introduction to methods and usage of using Date and SimpleDateFormat classes to process time in Java Introduction to methods and usage of using Date and SimpleDateFormat classes to process time in Java Apr 21, 2023 pm 03:01 PM

Introduction to methods and usage of using Date and SimpleDateFormat classes to process time in Java

What are the options for calendar and date libraries in Python? What are the options for calendar and date libraries in Python? Oct 21, 2023 am 09:22 AM

What are the options for calendar and date libraries in Python?

Implementing distributed task scheduling using Golang's web framework Echo framework Implementing distributed task scheduling using Golang's web framework Echo framework Jun 24, 2023 am 11:49 AM

Implementing distributed task scheduling using Golang's web framework Echo framework

Laravel development: How to implement WebSockets communication using Laravel Echo and Pusher? Laravel development: How to implement WebSockets communication using Laravel Echo and Pusher? Jun 13, 2023 pm 05:01 PM

Laravel development: How to implement WebSockets communication using Laravel Echo and Pusher?

See all articles