简体   繁体   中英

Formatting date/time in php 4

I'm working (or learning) on server with old php4 installed and most of the conventional methods from php5 for date/time formatting doesn't work in php4.

I have time string in this format:

2003-07-23 10:15:00

Now whats the easiest way to get date separately in 23.7.2003 format and then time in 10:15 format?

Have you ever tried strtotime?

print date('d.m.Y H:i', strtotime('2003-07-23 10:15:00'));

Code running on PHP 4

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM