addressalign-toparrow-leftarrow-leftarrow-right-10x10arrow-rightbackbellblockcalendarcameraccwcheckchevron-downchevron-leftchevron-rightchevron-small-downchevron-small-leftchevron-small-rightchevron-small-upchevron-upcircle-with-checkcircle-with-crosscircle-with-pluscontroller-playcredit-cardcrossdots-three-verticaleditemptyheartexporteye-with-lineeyefacebookfolderfullheartglobe--smallglobegmailgooglegroupshelp-with-circleimageimagesinstagramFill 1languagelaunch-new-window--smalllight-bulblightning-boltlinklocation-pinlockm-swarmSearchmailmediummessagesminusmobilemoremuplabelShape 3 + Rectangle 1ShapeoutlookpersonJoin Group on CardStartprice-ribbonprintShapeShapeShapeShapeImported LayersImported LayersImported Layersshieldstar-shapestartickettrashtriangle-downtriangle-uptwitteruserwarningyahooyoutube

Message boards will no longer be available after July 18, 2024.

We recommend saving any important information beforehand. Going forward, you can stay connected with your groups using the Discussions feature (we'll be rolling out some exciting updates soon)!

Learn more about the upcoming changes in this article;

Re: [php-49] Do you have the Time a minute from now?

From: Andrew
Sent on: Saturday, July 23, 2016, 10:02 PM
Hey Max,

This is a slightly different way to achieve a similar result.
My initial time is based on the current time, where as the other results above are based on a known timestamp.

 

date_default_timezone_set( 'America/Los_Angeles' );
 
$start_time = time();
$increment = 67; // number of seconds to increment by
echo date( 'c', $start_time ) . "\n";

for ($x = 1; $x < 12; $x++) {
    $interval = $increment * $x;   
   
    echo date('c', $start_time + $interval) . "\n";
}



#
# Andrew Woods
# Seattle, WA
# http://andrewwoods.net
#
#    "With each sunrise, we start anew"
#


On Sat, Jul 23, 2016 at 12:17 PM, Jeremy Cole Lindblom <[address removed]> wrote:
Yup, sorry. I missed copying $format into the top of the code sample. :-)

And yes, I'll be in Seattle for PNWPHP!

That reminds me: Y'all need to get your tickets!!! Check out the schedule this year: http://pnwphp.com/2016/schedule

--
Jeremy Lindblom (@jeremeamia)
Product Architect and Software Engineer at McGraw-Hill Education
Co-organizer of the Arizona PHP User Group (@azphp)

On Sat, Jul 23, 2016 at 12:14 PM, Tim Bond <[address removed]> wrote:
Jeremy's snippet works fine for me; just have to set $format to something that date() recognizes

https://3v4l.org/3VJ5L


On 7/23/[masked]:10, max steinmetz wrote:
Hi Jeremy - so i tried all three and all three gave me white pages of death.

I added default time, tried turning ‘$time’ to ‘$myTime’ in case ‘time’
was reserved keyword.
Not sure what i’m doing wrong.

Thanks

date_default_timezone_set('America/Los_Angeles');


// Using DateTime objects, via the date_* functions
// Using strtotime() function (Easiest)
$time = strtotime('[masked]:55:24');
for ($x = 0; $x < 12; $x++) {
$time = strtotime('+67 seconds', $time);
echo date($format, $time) . "<br>";
}

echo "<br>";

// Using DateTime objects, via the date_* functions
$time = date_create('[masked]:55:24');
for ($x = 0; $x < 12; $x++) {
date_add($time, date_interval_create_from_date_string('67 seconds'));
echo date_format($time, $format) . "<br>";
}

echo "<br>";

// Using DateTime objects, via Date* class methods
$time = new DateTime('[masked]:55:24');
for ($x = 0; $x < 12; $x++) {
$time->add(new DateInterval('PT67S'));
echo $time->format($format) . "<br>";
}




--
Please Note: If you hit "*REPLY*", your message will be sent to
*everyone* on this mailing list ([address removed]
<mailto:[address removed]>)
This message was sent by Meetup on behalf of max steinmetz
<http://www.meetup.com/seaphp/members/2821890/> from Seattle PHP User
Group <http://www.meetup.com/seaphp/>.
To report this message or block the sender, please click here
<http://www.meetup.com/seaphp/abuse/2821890/?table_name=ml&table_id=78878263>
Set my mailing list to email me As they are sent
<http://www.meetup.com/seaphp/list_prefs/?pref=1> | In one daily email
<http://www.meetup.com/seaphp/list_prefs/?pref=2> | Don't send me
mailing list messages <http://www.meetup.com/seaphp/list_prefs/?pref=0>

Meetup, POB 4668 #37895 NY NY USA 10163 <#> | [address removed]



--
Please Note: If you hit "REPLY", your message will be sent to everyone on this mailing list ([address removed])
http://www.meetup.com/seaphp/
This message was sent by Meetup on behalf of Tim Bond (http://www.meetup.com/seaphp/members/11114457/) from Seattle PHP User Group.
Set my mailing list to email me

As they are sent
http://www.meetup.com/seaphp/list_prefs/?pref=1

In one daily email
http://www.meetup.com/seaphp/list_prefs/?pref=2

Don't send me mailing list messages
http://www.meetup.com/seaphp/list_prefs/?pref=0

Meetup, POB 4668 #37895 NY NY USA 10163 | [address removed]






--
Please Note: If you hit "REPLY", your message will be sent to everyone on this mailing list ([address removed])
This message was sent by Meetup on behalf of Jeremy Cole Lindblom from Seattle PHP User Group.
To report this message or block the sender, please click here
Set my mailing list to email me As they are sent | In one daily email | Don't send me mailing list messages

Meetup, POB 4668 #37895 NY NY USA 10163 | [address removed]

People in this
group are also in: