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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T16:28:52+00:00 2026-06-10T16:28:52+00:00

I have this data available for use: Timezone of local time as integer: 8.75

  • 0

I have this data available for use:

Timezone of local time as integer: 8.75 (which is UTC+8.75)
1) 2012-09-04 03:15:03
2) 2012-09-03 18:30:03 (GMT)
3) 1346728503
4) 1346697003 (GMT)

Now, I’m wondering how to convert local time (1) to GMT one (2) (and vice versa) with consideration of all possible exceptions like summer times, 1970-2038 time limits etc.? Do they matter anyway?

PHP functions mainly don’t allow to specify timezone of local time to convert times – they take server’s local time which is not what I want (and I don’t want to alter it either). I can obviously subtract 8.75*60*60 from 1346728503 (3) but will this produce accurate value no matter what?

  • 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-10T16:28:53+00:00Added an answer on June 10, 2026 at 4:28 pm

    OK, first: PHP functions that accept timestamps don’t accept timezones because UNIX timestamps don’t know or care about time zones.

    As I type, it is Monday, September 3rd, 2012 at 15:30:10 in the US Eastern time zone, which is currently observing Daylight Saving Time (“summer time”). In the UTC time zone, that corresponds to 19:30:10. Either way, it’s UNIX timestamp (time_t value) 1,346,700,610. Depending upon your location on the Earth’s surface, your local time at that instant could fall anywhere in a 26-hour range, from 7:30:10 AM on September 3rd to 9:30:10 AM on September 4th (2012-09-03T07:30:10-12:00 to 2012-09-04T09:30:10+14:00). But no matter what your local label, the time in question is still 1,346,700,610 to UNIX and PHP.

    It looks like you attempted to calculate different time_t values based on time zone, but that doesn’t compute. Time zone offsets are never applied to time_t values, which don’t change; they are only applied to the human-readable representation.

    If at all possible, do not attempt to do your own time zone conversions. The rules tend to change. Right now, local time for me is four hours earlier than UTC; in a couple months, it will be 5 hours earlier. Moreover, the rules for when that change happens are different this year than they were five years ago. So depending on the specific time stamp value I’m trying to convert, I have to apply different rules.

    Use the library functions.

    To convert a string representation of a time into a time_t value, use strtotime. If the string contains a time zone reference, strtotime will do the conversion for you. If not, you can use date_default_timezone_set, as Connie suggested, to tell PHP what timezone to use when interpreting the string.

    To convert a time_t value back into a string, use date to get “local” time (that is, time according to the time zone set with date_default_timezone_set; you can ask PHP what that timezone is with date_default_timezone_get), or gmdate to get UTC.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been asked to develop an application which will use data available from
I have this data: /blabla/blabla (abs,def) /yxz I use this regex (.*)(?:\(([^$]*)\))?\n But it
I have an class which should send/receive data in packet form. This class contains
I have to use raw data available in .LIST extension files and I have
I have this data in cell A1: Majestic Properties Design District, LLC, Ste. 101,
i have this data | car_name | year | price | Honda | 2011
I have this data from a xml file: <?xml version=1.0 encoding=utf-8 ?> <words> <id>...</id>
I have this data: 1, 0., 0., 1500. . . 21, 0., 2000., 1500.
I have this data in a table, for instance, id name parent parent_id 1
Let say if I have this data my_data = [ 10 20 30 40;

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.