0

Possible Duplicate:
Convert time and date from one time zone to another in PHP

I have two variables which show the weeks start and end date as follows:

$week = strtotime('-' . date('w') . ' days');
$start = date('Y-m-d', $week);
$end = date('Y-m-d', strtotime('+6 days', $week));

How can I offset these dates for a different timezone (e.g. PST?)

Community
  • 1
  • 1
InvalidSyntax
  • 9,131
  • 20
  • 80
  • 127
  • See http://stackoverflow.com/questions/3905193/convert-time-and-date-from-one-time-zone-to-another-in-php. – Luqmaan Oct 28 '12 at 00:53

1 Answers1

1

This will convert a tie in your servers timezone to the given timezone.

$datetime = new DateTime;
$newTZ  = new DateTimeZone('Your/TimezoneHere');
$datetime->setTimezone($newTZ);
Martin Lyne
  • 3,157
  • 2
  • 22
  • 28