0

I have a timestamp which is like this

$timestamp = time();

so the $timestamp has 10 digit timestamp value...

now i use the follwoing code to convert it into (YYYY-mm-dd H:i) format by the following method

$act_time = date('Y-m-d H:i', $arr_timestamp); 

But now i want to convert it based on the GMT timezone format.. How can i achieve that?

NOTE: I dont want to use php's DateTime object
Saswat
  • 12,320
  • 16
  • 77
  • 156

1 Answers1

1

You can use date_default_timezone_set():

date_default_timezone_set("GMT");

List of Supported Timezones.

You can save the current timezone before changing it:

$backupTimezone = date_default_timezone_get();

In addition, instead of using these you can change the default timezone in your ini file: date.timezone

Debflav
  • 1,131
  • 7
  • 17