Need help with Date function

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
buchowski
Forum Newbie
Posts: 1
Joined: Fri Jul 25, 2003 4:36 pm

Need help with Date function

Post by buchowski »

i want to convert this : Fri Jul 25 14:33:21 2003 to seconds since 1970. so i use strtotime BUT
strtotime ("Fri Jul 25 14:33:21 2003"); doesn't work
i must put : strtotime ("Fri Jul 25 2003 14:33:21");
so from Fri Jul 25 14:33:21 2003 how to have Fri Jul 25 2003 14:33:21
i tried : date("D M j Y G:i:s", "Fri Jul 25 14:33:21 2003");

but it doesn't work...


so far i have managed this:

<?php
$string = "Fri Jul 25 14:33:21 2003";
list($week, $month, $day, $time, $year) = split(" ", $string);
$newdate = "$week $month $day $year $time";
echo "$newdate\n";
?>

to just move 14:33:21 to end
ie, reformat that time string

but it is quite messy, can anyone show me a proper/prettier way to do this . i would be happy! thanks...
matthiasone
Forum Contributor
Posts: 117
Joined: Mon Jul 22, 2002 12:14 pm
Location: Texas, USA
Contact:

Post by matthiasone »

Where does the time string come from?
Post Reply