Mobile app version of vmapp.org
Login or Join
Chiappetta492

: Why is my Last-Modified header always sent using GMT timezone? I want to send the last-modified in IST timezone, But it always sends in GMT. What is wrong with this PHP code? echo "Timezone

@Chiappetta492

Posted in: #Html #Http #HttpHeaders #Php #Server

I want to send the last-modified in IST timezone, But it always sends in GMT. What is wrong with this PHP code?

echo "Timezone " . date_default_timezone_get () ; //==>verified, timezone set correctly Asia/Kolkata
$timezone = new DateTimeZone("Asia/Kolkata");
$date = new DateTime($this->item->modified);
$date->setTimezone($timezone );
$mod_time = trim ($date->format('D, d M Y H:i:s'));
echo $mod_time;
header("Last-Modified: ". $mod_time . " IST", true) ;
// header("Last-Modified: ". $mod_time . " IST", true) ; //==> Tried this also, still sends in GMT

10% popularity Vote Up Vote Down


Login to follow query

More posts by @Chiappetta492

0 Comments

Sorted by latest first Latest Oldest Best

Back to top | Use Dark Theme