How to get current date, given a timezone in PHP

PHP date() function is an in-built function that simplifies working with date data types. The PHP date() function is used to format a date/time into a human-readable format.
In this tutorial, We will show you how to get the current date, given a timezone in PHP. Using PHP, you can get and display the current Date and Time from a specific timezone.
  • Create a new DateTime object with PHP.
  • Convert the DateTime object to the timezone of New_York using the DateTimeZone object.
  • Specify the date and time format.
Here’s an example of how to do this:
You can change the timezone in the DateTimeZone object and adjust the date format in the format() function.