473,396 Members | 1,875 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,396 software developers and data experts.

Formatting DateTime with an offset

I have an application that stores all DateTime inforamtion in UTC.
However, this application will be accessed from arround the world. I
would like my users to be able to specify their prefered TimeZone.
>From then on, i would like all DateTime information to be displayed in
their timezone.

I have written the code to do the timezone conversion. Now what
remains is finding a way to make every DateTime display in my
application use this code and get converted. I've tried to use the
culture info, the DateTimeFormatInfo class, i've even tried to make my
own custom formatter. No matter what I do, I can't seem to get my
DateTime.ToString() to go through my conversion code.

I have a lot of web pages, going through every page and every grid and
manually making a conversion would be tedious and prone to error. I'd
rather have DateTime.ToString go through some kind of formatting that
i am completely in control over and then i can do my formatting and
converting there.
Any help?

Jun 15 '07 #1
1 1612
DateTime a is sealed value type so you can not extend it. You will have
to write a class that encapsulates it. then its ToString() can do what
you want.

-- bruce (sqlwork.com)
Untitled wrote:
I have an application that stores all DateTime inforamtion in UTC.
However, this application will be accessed from arround the world. I
would like my users to be able to specify their prefered TimeZone.
>>From then on, i would like all DateTime information to be displayed in
their timezone.

I have written the code to do the timezone conversion. Now what
remains is finding a way to make every DateTime display in my
application use this code and get converted. I've tried to use the
culture info, the DateTimeFormatInfo class, i've even tried to make my
own custom formatter. No matter what I do, I can't seem to get my
DateTime.ToString() to go through my conversion code.

I have a lot of web pages, going through every page and every grid and
manually making a conversion would be tedious and prone to error. I'd
rather have DateTime.ToString go through some kind of formatting that
i am completely in control over and then i can do my formatting and
converting there.
Any help?
Jun 15 '07 #2

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

Similar topics

0
by: Symon R | last post by:
This is a bit of a weird one that I haven't yet been able to solve - I'm hoping someone out there can disprove my findings and tell me where I've gone wrong! I have designed a web service that...
2
by: BjörnHolmberg | last post by:
Hi everyone! In the following code we get a UTC offset in xml. Since I want my WAP users in UTC+02:00 to see data on a server in some US time zone, a lot of confusion will be created from this...
2
by: Sterling Ledet | last post by:
I am trying to create a web service that takes a string from my web server in the following format: Mon, 6 Oct 2003 18:39:47 UTC and put's in a datetime so it can then be reformatted in C# as...
9
by: Phil B | last post by:
I am having a problem with a datetime from a web services provider The provider is sending the following SOAP response <?xml version="1.0" encoding="utf-8"?> <soap:Envelope...
2
by: JC Voon | last post by:
hi: Is there a function to format the datetime value to the following format 2005-09-29T17:57:03.0000000+08:00 ? currently i'm using a hard way Dim result As String
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...
0
by: David Pratt | last post by:
Hi. I am creating a couple of small methods to help me manage time from UTC as standard but I am getting strange results. If I start with a datetime of 2005-12-12 14:30:00 in timezone...
4
by: Ken Wigle | last post by:
All, I would be very grateful for any help on this question. I have an application in asp.net 2.0 where I dynamically create a datatable and then bind that to a gridview. Unfortunately, the...
4
by: chandy | last post by:
Hi, I have a datetime+offset as a string and want to get two datetimes from it; the local and UTC. So far I can only do it by splitting on the + or - of the offset and creating a new date with...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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
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
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...
0
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...
0
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,...

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.