Is there an alternative data type "Date" that is more "ambiguous" than UTC?

A typical datatype Date

, in most programming languages, is a Unix timestamp, which is a "precise point in time".

But I want to know if there is a more "ambiguous" structure Date

that more accurately reflects the human perception of dates.

For example, say I want to represent a specific year ( 2000

) or a specific month ( January 2000

) or a specific day ( January 1, 2000

)?
I could save it as a Unix timestamp that would be 1/1/2000 12:00 AM GMT

.
But computers interpret timestamps according to their local time zone, so my computer will show 12/31/1999 5:00 PM PDT

and each computer will interpret it differently.

Since Unix timestamps seem to be the standard for precise points in time, I'm just wondering if there is any standard for ambiguous points in time.
If there is no standard, I would be happy to read about any specific implementations ( in any language ) that handle these scripts.

+3


source to share


1 answer


Yes, there are many places you will come across:



I am sure there are many others, however they do not necessarily exist for all languages. For example, PHP has a class DateTime

, but it knows about the timezone, and I don't believe there is a class that is not (or I couldn't find it anyway). JavaScript is another example as its object date

is a datetime object bound to a UTC-based timestamp.

BTW, these types (and more) are covered in the Pluralsight course, Basics of Date and Time , of which I am the author. You can check it out.
+2


source







All Articles