You are here: Re: Splitting date into chunks « PHP Programming Language « IT news, forums, messages
Re: Splitting date into chunks

Posted by Toby A Inkster on 11/29/07 09:33

velhari wrote:

> list($year, $month, $date, $hour, $minute, $second) = split(" ",date("Y
> m d H i s",timestamp));

Argh no! Take a look at his timestamp -- it's not a Unix timestamp, but an
ISO date with the punctuation removed.

Try:

preg_match('/(\d{4})(\d\d)(\d\d)(\d\d)(\d\d)(\d\d)/', $timestamp, $m);
list($dummy, $year, $month, $date, $hour, $minute, $second) = $m;
unset($dummy, $m);

--
Toby A Inkster BSc (Hons) ARCS
[Geek of HTML/SQL/Perl/PHP/Python/Apache/Linux]
[OS: Linux 2.6.17.14-mm-desktop-9mdvsmp, up 4 days, 16:18.]
[Now Playing: Semisonic - Sunshine and Chocolate]

Sharing Music with Apple iTunes
http://tobyinkster.co.uk/blog/2007/11/28/itunes-sharing/

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация