Skip to content
  • Github
  • Facebook
  • twitter
  • About Us
  • Contact Us
  • Privacy Policy
  • Terms & Conditions
  • Site Map

XpertPhp

Expertphp Is The Best Tutorial For Beginners

  • Home
  • Javascript
    • Jquery
    • React JS
    • Angularjs
    • Angular
    • Nodejs
  • Codeigniter
  • Laravel
  • Contact Us
  • About Us
  • Live Demos

Home » Php » How to Convert Date and Time from one timezone to another in php

How to Convert Date and Time from one timezone to another in php

How to Convert Date and Time from one timezone to another in php

Posted on April 14, 2022November 20, 2022 By XpertPhp

In this tutorial, we will explain to you how to convert date and time from one timezone to another in PHP. we can easily change the date and time from one timezone to another timezone using PHP.

1
2
3
4
5
6
$date = new DateTime('2022-03-12 12:45:00', new DateTimeZone('Europe/Berlin'));
echo $date->format('Y-m-d H:i:s');
echo "<br/>";
 
$date->setTimezone(new DateTimeZone('America/New_York'));
echo $date->format('Y-m-d H:i:s');

Output

1
2
2022-03-12 12:45:00
2022-03-12 06:45:00

Please follow and like us:
error
fb-share-icon
Tweet
fb-share-icon

Related Posts:

  • How to change the date formate in php
  • how to get current date and time in php
  • Convert XML into Associative Array in PHP
  • PHP Ajax Insert Data in MySQL By Using Bootstrap Modal
  • PHP Ajax View Data in MySQL By Using Bootstrap Modal
  • PHP Registration with Email Verification using OTP
Php

Post navigation

Previous Post: how to get current date and time in php
Next Post: PHP Datatables CRUD Example

Latest Posts

  • How to disable button in React js
  • JavaScript Interview Questions and Answers
  • JQuery Interview Questions and Answers
  • How to update php 7 to php 8 in xampp on windows
  • How to get the tag name in jQuery
  • how to get html tag in javascript
  • Disable Browser Back Button Using Javascript
  • How to remove file extension using htaccess
  • Matched leaf route at location does not have an element
  • Export ‘Switch’ (Imported As ‘Switch’) Was Not Found In ‘React-Router-Dom’ With Example

Tools

  • Compound Interest Calculator
  • Hex to RGB Color Converter
  • Pinterest Video Downloader
  • Birthday Calculator
  • Convert JSON to PHP Array Online
  • JavaScript Minifier
  • CSS Beautifier
  • CSS Minifier
  • JSON Beautifier
  • JSON Minifier

Categories

  • Ajax
  • Angular
  • Angularjs
  • Bootstrap
  • Codeigniter
  • Css
  • Htaccess
  • Interview
  • Javascript
  • Jquery
  • Laravel
  • MongoDB
  • MySql
  • Nodejs
  • Php
  • React JS
  • Shopify Api
  • Ubuntu

Tags

angular 10 tutorial angular 11 ci tutorial codeigniter 4 image upload Codeigniter 4 Tutorial codeigniter tutorial CodeIgniter tutorial for beginners codeigniter with mysql crud operation eloquent relationships file upload File Validation form validation Image Upload jQuery Ajax Form Handling jquery tricks jquery tutorial laravel 6 Laravel 6 Eloquent Laravel 6 Model laravel 6 relationship laravel 6 relationship eloquent Laravel 6 Routing laravel 7 Laravel 7 Eloquent laravel 7 routing laravel 7 tutorial Laravel 8 laravel 8 example laravel 8 tutorial laravel 9 example laravel 9 tutorial Laravel Framework laravel from scratch Laravel Socialite laravel social login nodejs pagination payment gateway php with mysql react js example react js tutorial send mail validation wysiwyg editor

Copyright © 2018 - 2023,

All Rights Reserved Powered by XpertPhp.com