transforming US date format into English date format, howto?
Posted: Wed Apr 14, 2004 11:49 am
hi,
the following code is where i stucked. Maybe someoen could help.
The following snipet of code works just fine as long as I use US
Date formate i.e. m/d/y.
I have tried the whole day in order to find out how to find the difference
between two dates which are in English date formate i.e. d/m/y.
What should I modify? I tried this:
But I am aparently making a mistake. mktime function takes the date
value inside date1 and date2 as month and gives a result that is not
what i want. I wanted to show that the difference is 5 days.
I tried this one too
but i am still unable to transform the american format into English
formate.
can anybody help?
the following code is where i stucked. Maybe someoen could help.
The following snipet of code works just fine as long as I use US
Date formate i.e. m/d/y.
I have tried the whole day in order to find out how to find the difference
between two dates which are in English date formate i.e. d/m/y.
Code: Select all
<?php
<?php
$dateDiff = mktime(12,0,0,04,20,2003) - mktime(11,0,0,04,20,2003);
echo 'Difference in seconds: ' . $dateDiff . '<br />';
echo '<br />Years Difference = '. floor($dateDiff/365/60/60/24);
echo '<br />Months Difference = '. floor($dateDiff/60/60/24/7/4);
echo '<br />Weeks Difference = '. floor($dateDiff/60/60/24/7);
echo '<br />Days Difference = '. floor($dateDiff/60/60/24);
echo '<br />Hours Difference = '. floor($dateDiff/60/60);
echo '<br />Minutes Difference = '. floor($dateDiff/60);
?>
?>Code: Select all
$date1=15-04-04;
$date2=20-04-04;
$dateDiff = mktime(12,0,0,$date2) - mktime(11,0,0,$date1);value inside date1 and date2 as month and gives a result that is not
what i want. I wanted to show that the difference is 5 days.
I tried this one too
Code: Select all
$date3= date("d-m-Y", mktime(0,0,0,$date1) );
$date4=date("d-m-Y", mktime(0,0,0,$date2) );formate.
can anybody help?