0

is there a way to change this:

  $modtime=date("M j Y g:i A", filemtime($dirArray[$index]));
  $timekey=date("YmdHis", filemtime($dirArray[$index]));

Print

<td sorttable_customkey='$timekey'  class='files_ed_02'>$modtime</td>

into gmdate and adding two hours to the stamp? Trying to show the local time for when a file was uploaded to the server.

Edit

Aware that this is a common question, but because gmdate() only can hold 2 parameters, it seams? this won't work

      $modtime=gmdate("M j Y g:i A",modtime()+(2*60*60), filemtime($dirArray[$index]));
      $timekey=gmdate("YmdHis",timekey()+(2*60*60), filemtime($dirArray[$index]));
Freshman
  • 293
  • 3
  • 8
  • 19
  • 1
    How to add time to a timestamp has been asked here numerous times. Just search for it. You'll find your answer. – John Conde Oct 16 '13 at 15:11
  • Useful for you: http://stackoverflow.com/questions/2515047/how-do-i-add-24-hours-to-a-unix-timestamp-in-php?rq=1 – opalenzuela Oct 16 '13 at 15:11
  • You are casting all your dates to strings. You simply cannot do date math with strings. It's like trying to add `'three'` and `'four'`. – Álvaro González Oct 16 '13 at 15:13

1 Answers1

1

Just add 2 hours to the unix timestamp you get from filemtime:

$modtime=date("M j Y g:i A", (filemtime($dirArray[$index]) + (2*60 * 60));

You can't send it as a separate parameter, filemtime will return an integer so just add on to it.

Pitchinnate
  • 7,517
  • 1
  • 20
  • 37