473,573 Members | 2,899 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Display date in EST/EDT from an Arizona server

Max
I need to display time as Eastern Time. The problem I'm having is that our server is in Arizona where there is no Daylight Savings
time. That means half the year I need to add 2 hours to the time and other other half I need to add 3 hours. I was trying to use
IsDaylightSavin gTime by passing the local date time but it is never daylight savings so it always returns false. Is there a way to
force the method to look at the time as ET or is there any other way around this?

This always returns false....

if ( System.TimeZone .IsDaylightSavi ngTime(DateTime .Now) )
{
lblCurrentDate. Text = DateTime.Now.Ad dHours(2).ToStr ing("D");
}
else
{
lblCurrentDate. Text = DateTime.Now.Ad dHours(3).ToStr ing("D");
}

Jan 31 '06 #1
2 3346
On Tue, 31 Jan 2006 16:06:35 -0500, "Max" <ma******@yahoo .com> wrote:
I need to display time as Eastern Time. The problem I'm having is that our server is in Arizona where there is no Daylight Savings
time. That means half the year I need to add 2 hours to the time and other other half I need to add 3 hours. I was trying to use
IsDaylightSavi ngTime by passing the local date time but it is never daylight savings so it always returns false. Is there a way to
force the method to look at the time as ET or is there any other way around this?

This always returns false....

if ( System.TimeZone .IsDaylightSavi ngTime(DateTime .Now) )
{
lblCurrentDate. Text = DateTime.Now.Ad dHours(2).ToStr ing("D");
}
else
{
lblCurrentDate. Text = DateTime.Now.Ad dHours(3).ToStr ing("D");
}


I don't know if you tried this or not, but it seems to me you could do
something like this:

When you get the time from the server use DateTime.UTC. In NYC use
DateTime.ToLoca lTime(). I think when you convert it in NYC you will
get the local time of the computer in NYC. I haven't tested this, but
it think it will work.

DateTime localTime = serverDateTime. ToLocalTime();

As a comment; It has always been my belief that when you are keeping
time records that are important, they should be in UTC. You can
always convert them back to local time when you need to.

Otis Mukinfus
http://www.otismukinfus.com
http://www.tomchilders.com
Feb 1 '06 #2
As Max said, I would keep all dates on the server in UTC format and convert
to local time on the clients. If you can't make that change, I have a local
to local time converter that respects TZ in c# I can post.

--
William Stacey [MVP]

"Max" <ma******@yahoo .com> wrote in message
news:%2******** *******@TK2MSFT NGP15.phx.gbl.. .
| I need to display time as Eastern Time. The problem I'm having is that
our server is in Arizona where there is no Daylight Savings
| time. That means half the year I need to add 2 hours to the time and
other other half I need to add 3 hours. I was trying to use
| IsDaylightSavin gTime by passing the local date time but it is never
daylight savings so it always returns false. Is there a way to
| force the method to look at the time as ET or is there any other way
around this?
|
| This always returns false....
|
| if ( System.TimeZone .IsDaylightSavi ngTime(DateTime .Now) )
| {
| lblCurrentDate. Text = DateTime.Now.Ad dHours(2).ToStr ing("D");
| }
| else
| {
| lblCurrentDate. Text = DateTime.Now.Ad dHours(3).ToStr ing("D");
| }
|
Feb 1 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
5398
by: Stupidgirl | last post by:
Hi, i have had no problem displaying the current date and time, on a static webpage. However, when i try to use the various PHP and MySQL snippets, it does'nt seem to work out. My success story can be seen on, amongst others, http:www.manchesterpaul.net/world.war.html http:www.manchesterpaul.net/world.govroy.html For this i used the...
4
1791
by: dmiller23462 | last post by:
Somebody take a look and give me any suggestions? My brain is nuked... Here's my deal....I have online submission forms on my intranet at work here....I am appending to an Access DB with the input from all HTML fields and then querying aforementioned DB with different variables (search by name, wave, reason, etc). The output that I'm...
3
1391
by: Need Top Programmer | last post by:
Has anyone else encountered this issue? When you do Date.parse(date1) and date1=10/29/2001 it seems to add an an additional 3600000 ms for no reason. Thanks, Edward
16
2081
by: WindAndWaves | last post by:
Hi there I have $initstartdate = date("d-m-Y"); in my code How can I get it to be date() + 1 or 7 for that matter. Because my server is in the US and I am in New Zealand, they are always a day behind....
2
3103
by: Benedict Teoh | last post by:
I created a dropdownlist containing day, month and year field and expose a property to assign a date. When I call from a aspx page and assign the value, the new date is not displayed until a submit is performed. How do I force the usercontrol to display the newly assigned date? I don't have this problem if I place the two dropdownlist and the...
3
1998
by: Jim in Arizona | last post by:
I have a simple query that queries an access database. One of the fields is date/time. I use this to extract the date from the field in access: CDate(objDataReader("date")).ToString When the webform is viewed, date and time both show up. (eg. 12/12/2005 12:00:00 AM) How do I get rid of the time? I've also tried...
13
10683
by: Jim Armstrong | last post by:
Hi all - This problem has been driving me crazy, and I'm hoping the answer is something stupid I am neglecting to see.... The procedure posted below is part of an Access/SQL database I have developed. Basically, the user would input a beginning and ending date, and the query goes and pulls records that meet the following criteria: 1....
3
1741
by: jim.murphy | last post by:
I am not sure If I can do this with a lookup, but what I would like to do is perhaps use lookup to retrieve a control date from an unassociated table to control what date is entered in another table. For example : the main table , table 1 has many entries with a field called date_ enter which is the date the record was entered. table 2 has...
3
2613
by: Pacer Dawn | last post by:
I have a web control that takes a date input. There are two types of validation I want to do on this: 1) validate that the date input is in the proper format, and display a message if otherwise 2) validate that the date is not prior to today, and display a message if otherwise. For these validations, I use CompareValidator to ensure the...
0
7681
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
8000
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. ...
0
8194
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
6398
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...
1
5578
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...
0
3729
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3729
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1294
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1034
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...

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.