473,657 Members | 2,566 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to identify Daylight saving Time

119 New Member
Hi All,

I am trying for something in Daylight saving time. I have a eastern time stamp and the timezone (possible timezones CST,EST,PST,MST ,HST). Basically these are two input which is required for my daylight saving time calculation.

If the time zone is CST i have to convert the given eastern timestamp to central timestamp.
like

Expand|Select|Wrap|Line Numbers
  1. if ($timezone == "CST")
  2. $central = $eastern - 3600; 
  3.  
Now i have to find whether the given central timestamp ($central) is coming under the Daylight saving time or not. Can some one help me how to find daylight saving is true or false.?

Thanks in advance,

Thanks,
Magesh
Dec 7 '11 #1
1 2655
dlite922
1,584 Recognized Expert Top Contributor
See date() manual.

What you're looking for is the Capital "I" which return 1 if daylight saving (summer march-november) and 0 if not (winter november-march).

So what you could do is some kind of calculation on your timezone, such as:

Expand|Select|Wrap|Line Numbers
  1.  
  2. $cental = $eastern - 3600 + (date('I') * 3600);
  3.  
  4.  
if date('I') returns zero, then 0*3600=0 basically adding nothing. If it is daylight savings time, then you add one more hour. IF $eastern is not already in daylight savings time.

Eastern standard time (EST) always equals central daylight time (CDT), in the math above:

$CDT = $EST - 3600 + 3600;
$CDT = $EST + 0;

Hope that helped,


Dan
Dec 12 '11 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

3
1793
by: Warren | last post by:
Is there a way to check if the system is currently in Daylight Saving Time? I'm trying to convert a DateTime from GMT to CST or CDT, but I'd like to be able to figure out which at runtime. Thanks.
3
1684
by: zmau | last post by:
Hi, I would like to know if Daylight Saving time is ON, and then calculate the time (i.e. how many hours difference due to the Daylight Saving time). I need it because I am getting the time from a GPS system, and I want to set the clock correctly. I am working on a Win2K system (OBviously it should work on XP etc.)
11
1930
by: cwdjrxyz | last post by:
Several threads have discussed the accuracy of time calculated using script when Daylight Saving Time (DST) is considered. A page at http://webexhibits.org/daylightsaving/ gives much information on DST, and how it differs in various parts of the world. There is a calculator for the US and EU systems. However there are other variations in the world. In the US, I live in the CST time zone. However this is called CDT when DST is in effect....
6
8836
by: Robm | last post by:
Since googling this issue only brings up the April fool's problem, which was solved years ago, I hope that somebody can help me with this. I have a large vc++/mfc application which needs to know when DST is in effect. This has been working fine for years, but I am worried about the upcoming change in 2007 in the US, which will be followed by a number of Canadian provices (where my application is used). The function that I use is very...
0
1504
by: Chirag Shukla | last post by:
Colleagues, I wanted to share a function to find if a date is in Daylight Saving Time or not. I was able to make this function faster than reading MSDN to find functions that .NET provides. I didnt know if .NET was equipped with the new changes President Bush made with respect to Daylight Saving Time increase starting 2007. I could have found out by trying ..NET functions, only if I wasnt a lousy syntax scavanger. Here goes:
2
3058
by: maflatoun | last post by:
Hi guys, I have to make a event signup page for our company that would display the event time/date in 3 different time zones (Eastern - New York, Central - Chicago, and Pacific - San Francisco). To do this. I convert the inputed date from local time zone and convert it into UTC and store it in the database (correct me if I'm wrong please). Next to display it I would add the correct time zone difference value (-5 for Eastern). How to do...
1
2401
by: mazdotnet | last post by:
Hi guys, I have to make a event signup page for our company that would display the event time/date in 3 different time zones (Eastern - New York, Central - Chicago, and Pacific - San Francisco). To do this. I convert the inputed date from local time zone and convert it into UTC and store it in the database (correct me if I'm wrong please). Next to display it I would add the correct time zone difference value (-5 for Eastern). How to do...
1
3211
by: maflatoun | last post by:
Hi everyone, I have 3 different time zones that I'm working with. Basically converting from UTC to those 3 time zones. Eastern Daylight Time (GMT -04:00, New York) Central Daylight Time (GMT -05:00, Chicago) Pacific Daylight Time (GMT -07:00, San Francisco) Using C# I know how to detect if Daylight saving time is applied or not
1
4524
by: maflatoun | last post by:
Hi everyone, I have 3 different time zones that I'm working with. Basically converting from UTC to those 3 time zones. Eastern Daylight Time (GMT -04:00, New York) Central Daylight Time (GMT -05:00, Chicago) Pacific Daylight Time (GMT -07:00, San Francisco) Using C# I know how to detect if Daylight saving time is applied or not
2
2612
by: _mario.lat | last post by:
Hallo, I have to calculate difference in seconds between two timestamp (unixtime). the problem is when there is daylight saving time so in this case end-start shoultd be negative and wrong data. How can I do? there is a function that lead this problem? Thank you in advance, Mario.
0
8397
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8827
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8605
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7333
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6167
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5632
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
2731
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1957
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1620
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.