You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
period, java.time, (a "human language" period, where duration is necessarily fixed, because months have different number of days and because daylight-saving-time),
Additionally, we may need special type for time zones and offsets.
(PS: I don't think this is a priority right now, just filing the issue)
I think datetime_tz is what is called DateTimeOffset in .NET. Not sure which is the better name.
Are these primitive data types of complex data types (i.e. structs). Structs could have methods and properties on them. Example: datetime.hour or time.minute.
If these are complex data types, maybe they should be named pascal case as opposed to primitive data types which are lower case. Example Date, Time, and DateTime.
PHP have the DateTime class. Python have the datetime class. .NET also have the third-party NodaTime library.
I think it should be possible to add and subtract time. In .NET you can do DateTime.Now.AddHours(3).
FYI @aljazerzen and I discussed this on the dev call, we agreed it was potentially cool but required a bunch of infra (e.g. Enums) that we don't have yet. So we can push to the future.
I agree with most of these and just have two questions I think:
Like @vanillajonathan asked, what's the difference between instant / moment and datetime?
duration vs period: my understanding from the explanation given is that duration would be a fixed number of seconds whereas period is a "human language" time period like a "month" say, correct? In SQL the term INTERVAL is often used and that could map onto either of these I guess?
instant / moment describes a moment in time. datetime describes a date + time, for example 2031-12-19 08:27, which is time-zone dependent and might describe a different instant if the daylight-saving-time changes in the next 8 years.
datetime_tz describes date, time and timezone and depends on the definition of timezone, which might change in the future, due to day-light-saving time. This should be used for setting for example a meeting time, where you want it to be at "9:00 AM CEST on some date", regardless of the changes to the timezone shifts. This type also supports things like "add one month", while instant does not.
Activity
vanillajonathan commentedon Mar 12, 2023
Why are
instantormomentneeded as separate data types instead of just being functions that create instances of thedatetimedata type?I like
date,timeanddatetime.In .NET
dateis calledDateOnlyandtimeis calledTimeOnly.I think
datetime_tzis what is calledDateTimeOffsetin .NET. Not sure which is the better name.Are these primitive data types of complex data types (i.e. structs). Structs could have methods and properties on them. Example:
datetime.hourortime.minute.If these are complex data types, maybe they should be named pascal case as opposed to primitive data types which are lower case. Example
Date,Time, andDateTime.PHP have the
DateTimeclass. Python have thedatetimeclass. .NET also have the third-party NodaTime library.I think it should be possible to add and subtract time. In .NET you can do
DateTime.Now.AddHours(3).max-sixty commentedon Dec 17, 2023
FYI @aljazerzen and I discussed this on the dev call, we agreed it was potentially cool but required a bunch of infra (e.g. Enums) that we don't have yet. So we can push to the future.
snth commentedon Dec 18, 2023
I agree with most of these and just have two questions I think:
instant/momentanddatetime?durationvsperiod: my understanding from the explanation given is thatdurationwould be a fixed number of seconds whereasperiodis a "human language" time period like a "month" say, correct? In SQL the termINTERVALis often used and that could map onto either of these I guess?aljazerzen commentedon Dec 19, 2023
instant/momentdescribes a moment in time.datetimedescribes a date + time, for example2031-12-19 08:27, which is time-zone dependent and might describe a different instant if the daylight-saving-time changes in the next 8 years.vanillajonathan commentedon Dec 19, 2023
So what is the difference between
instant/momentanddatetime_tz?aljazerzen commentedon Dec 19, 2023
datetime_tzdescribes date, time and timezone and depends on the definition of timezone, which might change in the future, due to day-light-saving time. This should be used for setting for example a meeting time, where you want it to be at "9:00 AM CEST on some date", regardless of the changes to the timezone shifts. This type also supports things like "add one month", whileinstantdoes not.