create date??

Reply

Join Date: Apr 2008
Posts: 297
Reputation: Aamit has a little shameless behaviour in the past 
Solved Threads: 11
Aamit Aamit is offline Offline
Posting Whiz in Training

create date??

 
0
  #1
Dec 20th, 2008
In my variable
$time=2008-12-19 14:12:10 this value is in database
and
duration to find next date is 21157 in seconds
$event_length=21157

Suppose today's date is 2008-12-21
How to find next date by using $time value??
$timestamp = strtotime("$time");
$etime = strtotime("+$event_length seconds", $timestamp);

$next_time = date('Y:m:d H:i:s', $etime); //here date get's today's date 
So my problem is How to find next time and date??
Reply With Quote Quick reply to this message  
Join Date: Jun 2008
Posts: 62
Reputation: PomonaGrange is an unknown quantity at this point 
Solved Threads: 3
PomonaGrange PomonaGrange is offline Offline
Junior Poster in Training

Re: create date??

 
0
  #2
Dec 20th, 2008
in your example, You have already converted your date to a timestamp and have the event length in seconds, so just add the seconds to the timestamp. Here, Try This...
  1. $timestamp = strtotime("$time");
  2. $etime = $timestamp+$event_length;
  3. $next_time = date('Y:m:d H:i:s', $etime); //here date get's today's date
Hope It Helps.
There are alot of people smarter than me, BUT at least I try to be of some help. Of coarse I'm not perfect, I need help too.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the PHP Forum


Views: 790 | Replies: 1
Thread Tools Search this Thread



Tag cloud for PHP
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC