if i convert to 72 hrs mktime
after that
i want to convert to mktime value to 72 hrs how to do that
mktime
Moderator: General Moderators
-
prasadharischandra
- Forum Commoner
- Posts: 57
- Joined: Thu May 09, 2002 2:19 am
- Location: sri lanka
- Contact:
- twigletmac
- Her Royal Site Adminness
- Posts: 5371
- Joined: Tue Apr 23, 2002 2:21 am
- Location: Essex, UK
-
prasadharischandra
- Forum Commoner
- Posts: 57
- Joined: Thu May 09, 2002 2:19 am
- Location: sri lanka
- Contact:
time
my code is
$today = date("j F ,Y");
#.........Month array..............
$allMonths["Jan"]=1;$allMonths["Feb"]=2;$allMonths["Mar"]=3;$allMonths["Apr"]=4;
$allMonths["May"]=5;$allMonths["Jun"]=6;$allMonths["Jul"]=7;$allMonths["Aug"]=8;
$allMonths["Sep"]=9;$allMonths["Oct"]=10;$allMonths["Nov"]=11;$allMonths["Dec"]=12;
#----------------------------------------------
# get Hours and Minute
$timeTake=explode(":",$select_time);
# get month and Year
$mYear=explode(" ",$select_myear);
# get set variables
$monthTake=$allMonths[$mYear[0]];
$yearTake=$mYear[1];
$dateTake=intval($select_day);
$hourTake=intval($timeTake[0]);
$minuteTake=intval($timeTake[1]);
# now make PHP time stamp for Flght Depature Time
$flightDepTime=mktime($hourTake,$minuteTake,0,$monthTake,$dateTake,$yearTake);
i want to take "$flightDepTime" in convert to previous value
i.e if i input 72 hrs then it will become a mktime
so i want to take a 72
for example
1028656800 ------convert to hours (72 or..)
$today = date("j F ,Y");
#.........Month array..............
$allMonths["Jan"]=1;$allMonths["Feb"]=2;$allMonths["Mar"]=3;$allMonths["Apr"]=4;
$allMonths["May"]=5;$allMonths["Jun"]=6;$allMonths["Jul"]=7;$allMonths["Aug"]=8;
$allMonths["Sep"]=9;$allMonths["Oct"]=10;$allMonths["Nov"]=11;$allMonths["Dec"]=12;
#----------------------------------------------
# get Hours and Minute
$timeTake=explode(":",$select_time);
# get month and Year
$mYear=explode(" ",$select_myear);
# get set variables
$monthTake=$allMonths[$mYear[0]];
$yearTake=$mYear[1];
$dateTake=intval($select_day);
$hourTake=intval($timeTake[0]);
$minuteTake=intval($timeTake[1]);
# now make PHP time stamp for Flght Depature Time
$flightDepTime=mktime($hourTake,$minuteTake,0,$monthTake,$dateTake,$yearTake);
i want to take "$flightDepTime" in convert to previous value
i.e if i input 72 hrs then it will become a mktime
so i want to take a 72
for example
1028656800 ------convert to hours (72 or..)
- twigletmac
- Her Royal Site Adminness
- Posts: 5371
- Joined: Tue Apr 23, 2002 2:21 am
- Location: Essex, UK
You shouldn't be converting 72 hours to a timestamp. Read this:
http://www.php.net/manual/en/function.mktime.php
which will explain what a timestamp is. You could have two timestamps which are 72 hours apart and you could subtract one from the other to get the difference in seconds between them. Since you'd have an answer in seconds it's easy enough just to divide that by 3600 to get the number of hours.
PHP has a lot of date and time functions you should read up on them:
http://www.php.net/manual/en/ref.datetime.php
Mac
http://www.php.net/manual/en/function.mktime.php
which will explain what a timestamp is. You could have two timestamps which are 72 hours apart and you could subtract one from the other to get the difference in seconds between them. Since you'd have an answer in seconds it's easy enough just to divide that by 3600 to get the number of hours.
PHP has a lot of date and time functions you should read up on them:
http://www.php.net/manual/en/ref.datetime.php
Mac