Welcome to collectivesolver - Programming & Software Q&A with code examples. A website with trusted programming answers. All programs are tested and work.

Contact: aviboots(AT)netvision.net.il

Semrush - keyword research tool

Create your online store today with Shopify

Turn ChatGPT, Claude, Gemini, And CoPilot Into Your Personal Assistant, Business Coach, Content Creator, And More

AFFILIATE MARKETING Your all-in-one performance engine Manage affiliates, creators, and customer referrals in one unified platform—turning every partnership into measurable growth

Secure & Reliable Web Hosting, Free Domain, Free SSL, 1-Click WordPress Install, Expert 24/7 Support

Disclosure: My content contains affiliate links.

43,693 questions

57,001 answers

573 users

How to set time zone and get the current time of the specified country with PHP

1 Answer

0 votes
date_default_timezone_set("America/New_York");
echo "The time in America/New_York is: " . date("h:i:sa") . "<br />";

date_default_timezone_set("Asia/Tokyo");
echo "The time in Asia/Tokyo is: " . date("h:i:sa") . "<br />";

date_default_timezone_set("Israel");
echo "The time in Israel is: " . date("h:i:sa") . "<br />";

date_default_timezone_set("Europe/Berlin");
echo "The time in Europe/Berlin is: " . date("h:i:sa") . "<br />";

/*
run:
  
The time in America/New_York is: 05:24:50am
The time in Asia/Tokyo is: 07:24:50pm
The time in Israel is: 12:24:50pm
The time in Europe/Berlin is: 11:24:50am
 
*/

 



answered Nov 27, 2015 by avibootz

Related questions

1 answer 254 views
254 views asked Aug 5, 2022 by avibootz
1 answer 299 views
1 answer 175 views
175 views asked Oct 26, 2023 by avibootz
...