Page 1 of 1

mktime

Posted: Mon Aug 12, 2002 3:58 am
by prasadharischandra
if i convert to 72 hrs mktime
after that
i want to convert to mktime value to 72 hrs how to do that

Posted: Mon Aug 12, 2002 4:48 am
by twigletmac
What exactly are you trying to achieve? Are you trying to add 72 hours to a timestamp or what? You really need to explain yourself a little bit better so that we can help you.

Mac

time

Posted: Mon Aug 12, 2002 10:54 pm
by prasadharischandra
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..)

Posted: Tue Aug 13, 2002 2:06 am
by twigletmac
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