本文介绍了将日期拆分成块的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我确定这是一个简单的,但我似乎无法找到它!我有
日期和时间:
#2007年11月28日,晚上11:11:14
$ timestamp = 20071128231114;
在Perl中,我会将其拆分为:
my($ year,$ month,$ day,$ hr, $ min,$ sec)= $ timestamp =〜/(\d {4})(\d
\ d)(\\\)(\\\ d)(\d\d)(\d\d)/;
如何在PHP中执行相同的操作?我知道我可以使用
课程的子课程,但必须有一个更好的方式让我忽略。
TIA,
Jason
解决方案
I''m sure this is an easy one, but I can''t seem to find it! I have the
date and time as:
# Nov 28, 2007, 11:11:14pm
$timestamp = 20071128231114;
In Perl, I would split this up as:
my ($year, $month, $day, $hr, $min, $sec) = $timestamp =~ /(\d{4})(\d
\d)(\d\d)(\d\d)(\d\d)(\d\d)/;
How do I do the same thing in PHP? I know that I can use substr, of
course, but there has to be a better way that I''m overlooking.
TIA,
Jason
解决方案
这篇关于将日期拆分成块的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!