• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 283
  • Last Modified:

Current time and date + 10 minutes

Hi all,

The following contains the current time and date separated in minutes, hour, day, month and year:

$minutes = date(i);
$hour = date(G);
$day = date(j);
$month = date(n);
$year = date (Y);

I need exactly the same plus 10 minutes (the current time and date but 10 minutes ahead).
How can I do that?
Thanks in advance!
0
Dada44
Asked:
Dada44
  • 4
  • 3
1 Solution
 
shobinsunCommented:
Hi,

Use this:

$entry_date = time();

$display_date = date("m/d/y H:i:s", strtotime($entry_date)+strtotime("10 minutes"));
0
 
Dada44Author Commented:
Thanks shobinsun, it's what I was looking for .. but how can I get the $display_date broke down into minute, hour, day, month and year?
Thanks once again!  
0
 
shobinsunCommented:
Hi,

This doing what you want:

date("m/d/y H:i:s", strtotime($entry_date)+strtotime("10 minutes"));

or use :

date("M/d/Y H:i:s", strtotime($entry_date)+strtotime("10 minutes"));
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
shobinsunCommented:
hi,

use

date("M D Y H:i:s", strtotime($entry_date)+strtotime("10 minutes"));
0
 
Dada44Author Commented:
Sorry, I don't get it, I'm too new to php :(

What I need is the time and date 10 minutes ahead separated in five variables, one for minutes, one for hour, one for day, one for month and one for year ..

Please pardon my "newbiness" :)
0
 
shobinsunCommented:
Hi use this:

$display_date1 = date("M", strtotime($entry_date)+strtotime("10 minutes"));
$display_date2 = date("D", strtotime($entry_date)+strtotime("10 minutes"));
$display_date3 = date("Y", strtotime($entry_date)+strtotime("10 minutes"));
$display_date4 = date("H", strtotime($entry_date)+strtotime("10 minutes"));
$display_date5 = date("i", strtotime($entry_date)+strtotime("10 minutes"));
$display_date6 = date("s", strtotime($entry_date)+strtotime("10 minutes"));
0
 
Dada44Author Commented:
thanks!!!
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 4
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now