0

I want to get the timezone abbreviation based on timezone name.for example, if the timezone name is America/New_york then in return I want to get the abbreviation as EST.Is there any solution available for it? I need the procedural style solution for it.Thank you

EvilsEmpire
  • 146
  • 2
  • 13

1 Answers1

4
<?php
function getabbreviatedtimezone($location){
$date = new DateTime(null, new DateTimeZone($location));
return $date->format('T');
}
echo "The Time Zone corresponding to 'America/New York' is ".getabbreviatedtimezone('America/New_York');
?>

should do that.

sjsam
  • 21,411
  • 5
  • 55
  • 102