Forum Moderators: coopster

Message Too Old, No Replies

formating string to date in PHP

         

bgb76

10:54 am on Jun 18, 2007 (gmt 0)

10+ Year Member



hi... this seems to be silly part for me to ask you anyone plz help me...

$day = $_POST['day'];
$month = $_POST['month'];
$year = $_POST['year'];

if
day = 12
month = 6
year = 1976
entered in form

how to format it into a date in php...

I know its really silly ... as im new to PHP i'm stumbling even at slightest pieces like this...
Will anybody help me pls...?

Habtom

11:54 am on Jun 18, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



What kind of format are you looking for?

$day = $_POST['day'];
$month = $_POST['month'];
$year = $_POST['year'];

$date = $day."/".$month."/".$year;

echo $date; would give you something like this 12/6/1976

$makingtime = date("F j, Y", mktime(0, 0, 0, $day, $month, $year));
//This would give you something like December 6, 1976

Habtom

TheCrow

12:24 pm on Jun 18, 2007 (gmt 0)

10+ Year Member



For more date formats, have a look at:
[ca.php.net...]