Is there an alternative data type "Date" that is more "ambiguous" than UTC?
A typical datatype
, 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
that more accurately reflects the human perception of dates.
For example, say I want to represent a specific year (
) or a specific month (
) 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.
source to share
Yes, there are many places you will come across:
In the ISO-8601 standard as a string in the YYYY-MM-DD format. For example,
October 8th, 2014.
In .NET languages such as C #, type
is date and time, but it is not necessarily associated with a specific point in time. This depends on the internal properties
which can be either
. When not specified, it is simply a date and time with no reference to any time zone. It still has a time component.
In the Java library, Joda Time
is a pure date with no time or time zone. Likewise,
is a date and time type without a time zone. You will also find these types in the new
API in Java 8 .
In C or C ++, the structure
represents the date and time of the calendar, regardless of the time zone. It is in the standard library along with a framework
which has the behavior you described in your question.
In Python, an object
represents a date without a time or time zone. The object
represents a date and time with an optional time zone. Python calls them naive when there is no time zone information and knows when a time zone is provided.
Many databases have date and time or date-only data types regardless of the time zone. I will not list all databases, but I will consider Microsoft SQL Server, which has a separate
I am sure there are many others, however they do not necessarily exist for all languages. For example, PHP has a class
is a datetime object bound to a UTC-based timestamp.
source to share