473,503 Members | 1,849 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 2635
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
1786
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
1671
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...
11
1916
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...
6
8829
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...
0
1494
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...
2
3050
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)....
1
2394
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)....
1
3205
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...
1
4507
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...
2
2601
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....
0
7205
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,...
0
7093
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7287
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,...
0
7467
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...
1
5021
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...
0
4685
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...
0
3166
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1519
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 ...
0
397
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...

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.