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
DynamiteHost
Forum Commoner
Posts: 69 Joined: Sat Aug 10, 2002 5:33 pm
Post
by DynamiteHost » Sun Nov 24, 2002 11:02 am
Ok... so I have this:
Its in DD MM YY format.
I need it to print 24th November 2002 instead...
How could I do this?
DynamiteHost
Forum Commoner
Posts: 69 Joined: Sat Aug 10, 2002 5:33 pm
Post
by DynamiteHost » Sun Nov 24, 2002 11:15 am
I'm having difficulty understanding that page
Could you whip up some code for me quickly... please?
hob_goblin
Forum Regular
Posts: 978 Joined: Sun Apr 28, 2002 9:53 pm
Contact:
Post
by hob_goblin » Sun Nov 24, 2002 11:47 am
Well, I just tried strtotime and it didn't work..
its going to be really hard to do it now..
hob_goblin
Forum Regular
Posts: 978 Joined: Sun Apr 28, 2002 9:53 pm
Contact:
Post
by hob_goblin » Sun Nov 24, 2002 11:54 am
Code: Select all
<?
$date = "24 11 02";
$date = explode(" ", $date);
if(substr($dateї'2'], 0, 1) == "0"){
$dateї'2'] = "20".$dateї'2'];
} else {
$dateї'2'] = "19".$dateї'2'];
}
$date = implode(" ", $date);
function str2date($in){
$t = split("/",$in);
if (count($t)!=3) $t = split("-",$in);
if (count($t)!=3) $t = split(" ",$in);
if (count($t)!=3) return -1;
if (!is_numeric($tї0])) return -1;
if (!is_numeric($tї1])) return -2;
if (!is_numeric($tї2])) return -3;
if ($tї2]<1902 || $tї2]>2037) return -3;
return mktime (0,0,0, $tї1], $tї0], $tї2]);
}
echo date("dS F Y", str2date($date));
?>
it will work for 10 years... its a little y2k bug, because you put the year in only two digits.
DynamiteHost
Forum Commoner
Posts: 69 Joined: Sat Aug 10, 2002 5:33 pm
Post
by DynamiteHost » Sun Nov 24, 2002 11:59 am
ok, thanks for all your help (yet again)