Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8698389
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T01:43:14+00:00 2026-06-13T01:43:14+00:00

I have provided date/time in this format: 2012-10-14T06:00 I can rework the data like

  • 0

I have provided date/time in this format: 2012-10-14T06:00

I can rework the data like this: 6:00am using

<?php
function formatDate($date, $format){
    $output = date($format, strtotime($date));
    return $output;
}
?>

<?php echo formatDate('2012-10-14T06:00', 'g:ia'); ?>

Outputs: 6:00am

Which is great, but how can i adjust the offset using

date_default_timezone_set(‘America/Los_Angeles’);

or

date_default_timezone_set(‘Europe/Amsterdam);

Which is set to the users timezone (whatever they choose) – the time should be offset between the orginal timezone data and the user provided (‘Europe/Amsterdam)

So if they set their default timezone to a different country the time would read 8:00am or 4:00am depending on that timezone offset.

The base timezone will always be in XXXX-XX-XXTXX:XX format.

Any help would greatly be appreciated

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T01:43:16+00:00Added an answer on June 13, 2026 at 1:43 am

    Use the DateTime objects. Manually extracting offsets will not take daytime savings and other quirks into account.

    // use the the appropriate timezone for your stamp
    $timestamp = DateTime::createFromFormat('Y-m-d\TH:i', '2012-10-14T06:00', new DateTimeZone('UTC'));
    // set it to whatever you want to convert it
    $timestamp->setTimeZone(new DateTimeZone('Europe/Amsterdam'));
    print $timestamp->format('Y-m-d H:i:s');
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a xml file that looks like this <a> <bb> <c date=20110706 time=1:20
I have some date returned from FTP server like this Aug 28 11:03 Aug
strtotime() in PHP works great if you can provide it with a date format
I have a query that produces a result like this: The data is sorted
I have types provided in a library I cant modify, such as this: namespace
I have tried all the solutions that have been provided including using PRAGMA but
I have downloaded a free astrology script in PHP. The script receives some data
I have this function to work out the relative time that has elapsed since
I need to store a specific time format in sql so I can ORDER
How can I change the date format of a DateTimePicker in vb.net so that

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.