0

Hi I'd like to take an hour off of a time stored in my DB and output it.

$row['expiration_abs_date'] = '2012-11-05 16:03:08'

Here's what I have:

date("M-j H:i \P\S\T",strtotime($row['expiration_abs_date'])) 

My best guess that doesn't work:

date("M-j H:i \P\S\T",strtotime($row['expiration_abs_date']) - strtotime(1 hour)) 
3
  • 3
    try strtotime($row['expiration_abs_date']) - 3600 Commented Nov 16, 2011 at 19:00
  • You could do it in the query. Here's a MySQL snippet: select date_add('2012-11-05 16:03:08', INTERVAL -1 HOUR) Commented Nov 16, 2011 at 19:07
  • 1
    SELECT timefield - INTERVAL 1 HOUR in mysql will do it for you without having to use multiple format conversions/roundtrips between time<->string values in PHP. Commented Nov 16, 2011 at 19:08

2 Answers 2

1
date("M-j H:i \P\S\T",strtotime($row['expiration_abs_date'])-3600) 
Sign up to request clarification or add additional context in comments.

Comments

1

strtotime($row['expiration_abs_date'].' -1 hour')

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.