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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T22:51:59+00:00 2026-05-22T22:51:59+00:00

From 5.3 the is_dst parameter is deprecated in mktime . But I need two

  • 0

From 5.3 the is_dst parameter is deprecated in mktime. But I need two previous time in timestamp, one of them with dst and the other without that.

E.g.: first time mktime("03","15","00","08","08","2008",1) and the other mktime("03","15","00","08","08","2008",0)

Can you help me to solve that problem?

  • 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-05-22T22:52:00+00:00Added an answer on May 22, 2026 at 10:52 pm

    Not a full answer, just some ideas I could think of… The DateTime::format() method accepts a format code that tells whether DST is on effect:

    $now = new DateTime;
    $is_dst = $now->format('I')==1;
    

    Now, in order to know what time it’d be if DST was the other way round, you have to find out when such change happens. This code:

    $time_zone = $now->getTimeZone();
    var_dump( $time_zone->getTransitions(strtotime('2011-01-01'), strtotime('2011-12-31')) );
    

    … prints:

    array(3) {
      [0]=>
      array(5) {
        ["ts"]=>
        int(1293836400)
        ["time"]=>
        string(24) "2010-12-31T23:00:00+0000"
        ["offset"]=>
        int(3600)
        ["isdst"]=>
        bool(false)
        ["abbr"]=>
        string(3) "CET"
      }
      [1]=>
      array(5) {
        ["ts"]=>
        int(1301187600)
        ["time"]=>
        string(24) "2011-03-27T01:00:00+0000"
        ["offset"]=>
        int(7200)
        ["isdst"]=>
        bool(true)
        ["abbr"]=>
        string(4) "CEST"
      }
      [2]=>
      array(5) {
        ["ts"]=>
        int(1319936400)
        ["time"]=>
        string(24) "2011-10-30T01:00:00+0000"
        ["offset"]=>
        int(3600)
        ["isdst"]=>
        bool(false)
        ["abbr"]=>
        string(3) "CET"
      }
    }
    

    If you obtain the transitions for year the date belongs to, you can collect a list of offsets according for isdst TRUE and isdst FALSE. Once you pick an appropriate offset, the rest is easy:

    $winter_offset = 3600;
    $summer_offset = 7200;
    $difference = $winter_offset-$summer_offset;
    $winter = $now->modify( ($difference<0 ? '' : '+') . $difference . ' seconds');
    echo $winter->format('H:i:s');
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to convert an existing (datetime fields) db from local time ut UTC.
From /usr/include/time.h: /* Used by other time functions. */ struct tm { int tm_sec;.
I need to convert a historical timestamp from GMT to BST in Delphi (Win32).
I have a Unix timestamp that comes from a database that is (unfortunately) in
I am working on project to convert Standard time + DST ( 20110710115500 +1200
I'm working on an application where I need to maintain times from different location.
I'm writing a script to copy compiled files from one location to another. What
I want to calculate whats the date 20 yrs back from current time in
I am trying to copy a directory from a location to other location and
I have a time-stamp in milliseconds ( Unix time / time from Epoch )

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.