473,387 Members | 1,785 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

TimeZone problems

Hi,

I have a datetime value that is already in GMT (UTC) time. What I would like to do is convert this
value into Pacific Standard Time, but I also need to account for daylight savings time.

Simply subtracting eight hours from the value will give me the proper time (subtracting seven hours
if daylight savings time). I tried using the TimeZone object to see if the value is in daylight
savings time like this

If TimeZone.IsDaylightSavingTime (value) = True Then
value.AddHours(-7)
Else
value.AddHours(-8)
End If

However, I always get a NullReferenceException (i.e. object reference not set to an instance of an
object) for the TimeZone object.

How do I properly use the TimeZone object? Since it is labeled as MustInherit, do I need to create
an object that inherits the TimeZone object just to use this method?

Thanks,
Roshawn
Jan 23 '06 #1
2 1196
Hi Roshawn,

I have the perfext fix for you.

www.TimeZoneSource.com

..NET component, both windows and web, very lightweight.

HTH

Dan
Roshawn Dawson wrote:
Hi,

I have a datetime value that is already in GMT (UTC) time. What I would like to do is convert this
value into Pacific Standard Time, but I also need to account for daylight savings time.

Simply subtracting eight hours from the value will give me the proper time (subtracting seven hours
if daylight savings time). I tried using the TimeZone object to see if the value is in daylight
savings time like this

If TimeZone.IsDaylightSavingTime (value) = True Then
value.AddHours(-7)
Else
value.AddHours(-8)
End If

However, I always get a NullReferenceException (i.e. object reference not set to an instance of an
object) for the TimeZone object.

How do I properly use the TimeZone object? Since it is labeled as MustInherit, do I need to create
an object that inherits the TimeZone object just to use this method?

Thanks,
Roshawn


Jan 23 '06 #2
Hey, thanks for the resource! :-)

dk******@dankisting.com wrote:
Hi Roshawn,

I have the perfext fix for you.

www.TimeZoneSource.com

.NET component, both windows and web, very lightweight.

HTH

Dan

Jan 23 '06 #3

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

Similar topics

0
by: Jason Kinkade | last post by:
I recently installed MySQL 4.0.18 on my slackware 9.1 machine (kernel 2.4.25) by compiling the source. It works fine, and all tests pass except one. The timezone test. Can someone tell me why...
7
by: Jim Davis | last post by:
I'm (still) working on an ISO 8601 date parser. I want to convert at least the formats described here: http://www.w3.org/TR/NOTE-datetime Well.. I've got most of it working (via RegEx's) good...
1
by: cnliou | last post by:
Hi! If I correctly understand v7.4 manual, value, say, '2003-11-26 12:00' in TIMESTAMP WITHOUT TIMEZONE column should output '2003-11-26 19:00' for "+08:00" timezone. The following test...
0
by: eastlands | last post by:
Not sure if this is an xml or a ado.net question: I have created an xml document from a .net dataset which contains a DateTime column, however all the time elements are set to 00:00:00. example...
2
by: David Garamond | last post by:
When a timestamp string input contains a timezone abbreviation (CDT, PST, etc), which timezone offset is used? The input date's or today date's? The result on my computer suggests the latter. #...
13
by: Bruno Wolff III | last post by:
Recently there has been some discussion about attaching a timezone to a timestamp and some other discussion about including a 'day' part in the interval type. These two features impact each other,...
3
by: asanford | last post by:
I want to create a web service that allows the caller to pass a DateTime to the web service (that is, create a web method such as void MyWebMethod(DateTime dt).) However, I want to be able to...
3
by: mac11 | last post by:
I have an app that runs under Linux (centos and LFS flavors) and I'm having problems with reading the correct time after I change the timezone (by moving the link at /etc/localtime to point to the...
2
by: =?Utf-8?B?Sm9ubnk=?= | last post by:
I have an ASP.NET 2.0 C# web application that is contacting an Exchange server using WEBDAV. It allows the users to look up appointments for a future date. The problem I have is determining the...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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
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...

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.