0

So basically I need to add 30mins to the current time and send it as a time stamp in database.

date_default_timezone_set('Asia/Hong_Kong');
$today = date("H:i:s");  

I.E i need current time : 10:00 sent time to database 10:30. I know the codes in sending it to the database i just want to know how to add certain mins or seconds to the current time.

Funk Forty Niner
  • 74,450
  • 15
  • 68
  • 141

2 Answers2

1

You would use the database time for this:

now() + interval 30 minute

You could set a column with the value as:

update t
    set col = now() + interval 30 minute
    where id = 1;
Gordon Linoff
  • 1,242,037
  • 58
  • 646
  • 786
0

Pretty simple, but go with the database solution if possible:

$today = date("H:i:s", strtotime(“+30 minutes”);
AbraCadaver
  • 78,200
  • 7
  • 66
  • 87