|
Kornfeld Eliyahu Peter wrote: worked on this project
Nice! Thanks for the link
Marc
|
|
|
|
|
Wow, I just read through the Trivia page. Geez, what a crazy world. I can't imagine the complexity historians have to deal with.
Marc
|
|
|
|
|
In my business we never store local time - conversion to/from that is always a UI or interface concern.
|
|
|
|
|
and how do you know which one is on the szenario of the phone call to the hotline?
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
Rating helpful answers is nice, but saying thanks can be even nicer.
|
|
|
|
|
When you enter a query (we don't have telephones in this business) the data are returned in UTC but displayed in local. In the example, yes we would need to know where the ATM was located.
|
|
|
|
|
Duncan Edwards Jones wrote: In my business we never store local time - conversion to/from that is always a UI or interface concern.
Yes, storing the UTC time is definitely the starting point, and I agree, the conversion to/from is a UI concern, but for it to do it's job correctly for the requirements, it may need additional information, at least, that's my thinking.
Marc
|
|
|
|
|
That is definitely needed, yes. Most operating systems and browsers support "locale" information to allow the user interface to discover its location.
For phone apps there is the Google maps Timezone API[^] and worst case scenario you can get the client to specify the timezone.
If you need to store where the time came from then you could have a "client offset" field that tells you what time the client thought it was when they wrote the record.
|
|
|
|
|
Time is an illusion. Lunch time doubly so.
However, you always store your times in UTC. Convert to local time for the observer, on-the-fly.
If I am reading this in CA, then show that time zone (with the -PST). If I am in Washington, show -EST or -EDT)....
Or did I misunderstand the question?
|
|
|
|
|
Basildane wrote: Convert to local time for the observer, on-the-fly.
A bit difficult for the szenario of calling the hotline.
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
Rating helpful answers is nice, but saying thanks can be even nicer.
|
|
|
|
|
Basildane wrote: However, you always store your times in UTC. Convert to local time for the observer, on-the-fly.
Yup.
Basildane wrote: Or did I misunderstand the question?
Except the time displayed may need to be relative to where/when the transaction took place, rather than where the viewer is.
Marc
|
|
|
|
|
Marc Clifton wrote: Except the time displayed may need to be relative to where/when the transaction took place, rather than where the viewer is. That's still ok. It's much better to have a single authoritative point of reference (UTC) and use that rather than multiple. Take for instance the blog post, that's supposed to be relative to the poster (not the viewer). Even with the time stamp in UTC, calculating the server offset from UTC and showing that to the user, in the servers timezone, is still just as easy.
UTC is your friend.
Jeremy Falcon
|
|
|
|
|
Marc Clifton wrote: not everyone knows what "UTC" is or even
That was "unbelievable tortoise crash" right?
Rules for the FOSW ![ ^]
if(this.signature != "")
{
MessageBox.Show("This is my signature: " + Environment.NewLine + signature);
}
else
{
MessageBox.Show("404-Signature not found");
}
|
|
|
|
|
Who the f**k is "not everyone"?
Press F1 for help or google it.
Greetings from Germany
|
|
|
|
|
The guy who knows even
Rules for the FOSW ![ ^]
if(this.signature != "")
{
MessageBox.Show("This is my signature: " + Environment.NewLine + signature);
}
else
{
MessageBox.Show("404-Signature not found");
}
|
|
|
|
|
HobbyProggy wrote: That was "unbelievable tortoise crash" right?
When the tortoise[^] crashes, the world comes to an end.
Marc
|
|
|
|
|
Link fail.
What do you get when you cross a joke with a rhetorical question?
The metaphorical solid rear-end expulsions have impacted the metaphorical motorized bladed rotating air movement mechanism.
Do questions with multiple question marks annoy you???
|
|
|
|
|
Just forget about Earth time and use galactic time.
if (Object.DividedByZero == true) { Universe.Implode(); }
Meus ratio ex fortis machina. Simplicitatis de formae ac munus. -Foothill, 2016
|
|
|
|
|
Foothill wrote: Just forget about Earth time and use galactic time.
That is awesome. I may actually let the user select that as an optional display format!
Marc
|
|
|
|
|
Marc Clifton wrote: Have you had to deal with this issue? Yes, and it drove me to distraction since no one seemed to understand the problem. Rather than storing the time as local we were saving it as UTC but with an added field that was the offset to local. It never worked satisfactorily, and the project got canned.
|
|
|
|
|
Richard MacCutchan wrote: It never worked satisfactorily, and the project got canned.
Seems like a problem looking for a solution. Hmmmm...
Marc
|
|
|
|
|
My last 'new' project was/is a cloud based timeclock. I'm probably doing it all wrong, but found it easier to store converted local times and straight utc times for everything. Of course, it all depends on the type of application and whether or not you have users in multiple time zones.
"Go forth into the source" - Neal Morse
|
|
|
|
|
kmoorevs wrote: but found it easier to store converted local times and straight utc times for everything.
Agreed, that should be the baseline (or is that "basetime"?)
kmoorevs wrote: Of course, it all depends on the type of application and whether or not you have users in multiple time zones.
Web app, possibly desktop app, but I'm poking at what hopefully can be a general solution "library" / best practices.
Marc
|
|
|
|
|
I think dealing with time in code is one of the hardest things I've worked on, and I still don't know what the best solution is. I've done it a lot over the years.
To avoid daylight saving issues, I tend to store everything in UTC (or GMT to give it its correct title!), then do local conversion. If everything feeds in UTC then at least the same DateTime refers to the same moment wherever you are. But if you have any scheduled tasks, these will need to be rescheduled twice a year as you enter and exit daylight saving.
The main problem is that other people don't (use UTC), DateTime.Now is too easy, and this humble type's 'kind' only tells you whether it is UTC/local etc, but not where local is. By the time its gone in and out of SQL server it might have been the time on the moon for all its worth.
Then there's UTC to local time and back conversion which is not that easy.
Hmmmmm, I don't know where I'm going with this - not a clue. Horrible. But good luck..!
Regards,
Rob Philpott.
|
|
|
|
|
Rob Philpott wrote: But good luck..!
Thanks!
But if you have any scheduled tasks, these will need to be rescheduled twice a year as you enter and exit daylight saving.
Ugh. Another interesting wrinkle in the fabric of time.
Hah! Just came up with the name for a potential article: "A Wrinkle in Time"
Marc
|
|
|
|
|
That's also the name of a children's book[^].
What do you get when you cross a joke with a rhetorical question?
The metaphorical solid rear-end expulsions have impacted the metaphorical motorized bladed rotating air movement mechanism.
Do questions with multiple question marks annoy you???
|
|
|
|