【发布时间】:2014-01-13 06:36:22
【问题描述】:
您好,我想从给定的字符串中获取日期“2014 年 1 月 8 日”。
Wednesday, 8 January 2014 at 17:40
如果能用preg_replace就好了?
【问题讨论】:
-
到目前为止你尝试了什么?
-
我不知道 preg_replace 但我现在使用它 $res = date('M d, Y',strtotime(trim(substr( $res,10,15)))) ;跨度>
-
我怀疑你是否需要使用 preg_replace,因为它的格式很好,用
strtotime将其转换为日期应该没有问题,然后使用date格式化它@ 987654325@ -
这个字符串给我默认值 January 01,1970
标签: php regex string preg-replace