如何将字符串转换为PHP中的日期格式? [英] How to convert string to date format in PHP?

查看:147
本文介绍了如何将字符串转换为PHP中的日期格式?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图将字符串格式的日期转换为日期格式,这里是示例

  1。 15Oct15至2015-10-15 
2. 151015至2015-10-15
3. 15102015至2015-10-15

请帮我找到解决方案。

解决方案

$ b 1. 15Oct15至2015-10-15
使用
date('Ym-d',strtotime(15Oct15)) p>

不确定其他2


I am trying to convert a date in string format to date format, here is the example

1. 15Oct15 to 2015-10-15
2. 151015  to 2015-10-15
3. 15102015 to 2015-10-15

Please help me to find a solution.

解决方案

You can convert 1. 15Oct15 to 2015-10-15 using date('Y-m-d', strtotime("15Oct15"))

Not sure of other 2

这篇关于如何将字符串转换为PHP中的日期格式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆