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 8365995
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T12:47:57+00:00 2026-06-09T12:47:57+00:00

I have a ISO8601 string with some arbitrary time zone. I don’t want to

  • 0

I have a ISO8601 string with some arbitrary time zone. I don’t want to convert to my time zone. Rather, I want to preserve the original time zone. I want to be able to format the output similar to how gmdate formats the date/time. For example:

$output =  my_date_function( 'F d, ga', $thetime );

Should output:

$thetime = '2012-09-24T21:00:00-0700';
     => September 24, 9pm

$thetime = '2012-09-24T21:00:00-0500';
     => September 24, 9pm
  • 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-09T12:47:58+00:00Added an answer on June 9, 2026 at 12:47 pm

    I don’t know if it would work but I think that DateTime::createFromFormat can do it automatically. You can also create a function that determine the timezone and create a DateTimezone object with it.
    http://php.net/manual/en/datetime.createfromformat.php
    According to the documentation :

    If timezone is omitted and time contains no timezone, the current timezone will be used

    Code:

    $stime = '2012-09-24T21:00:00-0500';
    $t = DateTime::createFromFormat(DateTime::ISO8601, substr($stime, 0, 19));
    $output = $t->format('F d, ga');
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an ISO 8601 time string and want to calculate the time difference
I have the function bellow. I want to add support for iso8601 time format
I have following XMLRPC response <value><struct> <member><name>dedicatedAccountID</name><value><i4>1</i4></value></member> <member><name>dedicatedAccountValue1</name><value><string>0</string></value></member> <member><name>expiryDate</name><value><dateTime.iso8601>99991231T00:00:00+1200</dateTime.iso8601></value></member> </struct></value> <value><struct> <member><name>dedicatedAccountID</name><value><i4>2</i4></value></member> <member><name>dedicatedAccountValue1</name><value><string>15635</string></value></member> <member><name>expiryDate</name><value><dateTime.iso8601>99991231T00:00:00+1200</dateTime.iso8601></value></member>
I have an SQLite database in which some columns are date-time strings with the
i have code in csharp that returns this string: {'dateTimeFormat': 'iso8601', 'wikiURL': http://simile.mit.edu/shelf/ ,
I want a dead simple generic $_GET-vars validator, and don't have any desire to
I have a strange problem when parsing a ISO8601 date and time with SimpleDateFormat.
I have a string in standard ISO 8601 format that contains the date/time returned
I have a date string like this ( ISO 8601 combined date and time
I have to deal in python with strings representing iso8601 timestamps. My timestamps string

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.