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

Globalization and time difference / zone

Hi,

Users can add news items on my website. Each news item have a create
date and time.
Now I want that users see the correct time in there zone.
(9 PM at location x can me 11 PM at location y).

How should I save my datatime in the database?
And how do I show the correct datetime for a specific user/culture?

Thanks!

Sep 3 '06 #1
2 1642
Edit:
(9 PM at location x can me 11 PM at location y).
can me --could be

I also don't understand the UtcNow.
In my Windows I have timezone +1 when I show the time with C# then I
see -2.
I don't understand this.

Second, I cannot find a function to long datetime. There is a longdate
and longtime, but not one combined???

Thanks!

Arjen wrote:
Hi,

Users can add news items on my website. Each news item have a create
date and time.
Now I want that users see the correct time in there zone.
(9 PM at location x can me 11 PM at location y).

How should I save my datatime in the database?
And how do I show the correct datetime for a specific user/culture?

Thanks!
Sep 3 '06 #2
How should I save my datatime in the database?
And how do I show the correct datetime for a specific user/culture?
You only UTC time in your database.

1. Get time in UTC
2. Find the offset of the TimeZone from UTC
3. Add the offset (TimeSpan) to the time in UTC
4. Display the new time... :-)
--
Happy Hacking,
Gaurav Vaish | http://www.mastergaurav.com
http://www.edujini.in | http://articles.edujini.in/webservices
-------------------
Sep 3 '06 #3

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

Similar topics

1
by: Steven | last post by:
I actually have two questions: 1. I try to get current time, but the time I got is 1 hour different from my local time. I assume it is caused by Time Zone. So is there any easy way to fix this?...
8
by: Monty | last post by:
Let's say you provide an online service from 7:00AM to 6:00PM Eastern Time (daylight time in the summer). Is there way of showing these hours of availability on a web page in the user's local...
2
by: Jason Priebe | last post by:
I'm a bit confused about SET TIME ZONE and its effect on PostgreSQL's date processing. In my experience with timestamps in all other *nix-based software systems, a timestamp is always a numeric...
3
by: Jon Davis | last post by:
The date string: "Thu, 17 Jul 2003 12:35:18 PST" The problem: // this fails on PST DateTime myDate = DateTime.Parse("Thu, 17 Jul 2003 12:35:18 PST"); Help? Jon
1
by: KW | last post by:
Hi all, Appreciate if someone can help me out on this. Currently, I have a tm structure holding information of the UTC time, which is very likely to be in the past, meaning not the current...
14
by: Cesar Ronchese | last post by:
Hello! I've built a program that show some dates to users. I got a problem when users have different configured time zone machines, where: - One machine that determined time zone the date...
4
by: Marlon | last post by:
What is the best way to deal time zone difference in Wep application. Is there a best pattern and practice for this?
7
by: Correia | last post by:
I have a webserver that is in another country and have a different time zone. How can i fix this and use the scripts with the correct time zone? Thanks
0
by: =?Utf-8?B?UmljaGFyZCBLaXJieQ==?= | last post by:
Hi, I have W Mobile 2003 SE v 4.21 on my O2 xda IIs PDA. Then I travel to a new time zone I would like to change the time on my PDA but each time it asks if you want to change the appoinment times...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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?
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
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...

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.