|
Posted by velhari on 11/29/07 05:56
On Nov 29, 9:13 am, Jason Carlton <jwcarl...@gmail.com> wrote:
> 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
Jason,
list($year, $month, $date, $hour, $minute, $second) = split("
",date("Y m d H i s",timestamp));
Hope it helps.
Thanks,
Velhari
[Back to original message]
|