Jump to content

subtract 15 minutes from mysql TIME


atstockland

Recommended Posts

Hi all -

 

Im have data stored in a mysql DB using the data type of TIME.  I dont want dateTime as I dont care about the date....just time.  I want to simply subtract 15 minutes from that time.  So, if the time in the database reads 13:00:00 I want to subtract 15 minutes from that so it reads 12:45 PM.

 

I have tried using:

$tourTime = $row_Recordset1['TheTimeInMyDatabase'];

$tourTime_seconds = strtotime ($tourTime);

$meetingTime_seconds = $tourTime_seconds - 900;

$adjustedTime = time ("h:i p", $meetingTime_seconds);

 

This seems like a really easy thing to do.  Im glad its a struggle for me because its teaching me more about php.....but now Im ready for it to work.

 

Thanks

Adam

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.