Unfortunately, despite all these contributions, we're not there yet. We do nothave "good", "seamless" calendaring integration in our everyday software.
There are extensions, patches, plugins, or even hacked versions of varioussoftware, but there is not many tools that have "calendaring" as a corefeature, or have provided interfaces for third-parties to implement their owncalendar.
I do believe that the root of this problem is the fact that "calendar type" isnot widely accepted as a core concept of software localisation (just like"verbal variety", "number format" and others). This leads developers throughthe implicit assumption that there is no need to provide any localization meansfor their date/time API (while they do provide such means for stringtranslation for example).
What do you think about having calendar support in date? I would like to hearfrom you about this before I start the task or contact GNU devs in list.
In my opinion, support for Solar Hijri has not been a priority for most of major commercial software developers outside of the Greater Iran. For FOSS, the story is probably different and it might summarize to lack of community support.
That is not true. Support for locale-specific calendars are one of the essential features of world-ready software and libraries. As an example, if you check the documentations for Unicode ICU library, you'd be surprised how extensive is the support for non-Gregorian calendars (hint: observational Islamic and Umm al-Qura are supported) in that library.
It is a good idea. Probably maintainers of `coreutils` are now more receptive (and better informed) than back in 2008.
What do you think about having calendar support in date? I would like to hear from you about this before I start the task or contact GNU devs in list.It is a good idea. Probably maintainers of `coreutils` are now more receptive (and better informed) than back in 2008.I don't think solar-hijri aware `date` would have much advantage over already existing tools like `jdate` [1]. I think an ideal approach is to have a multi-calendar libc implementation. That may look a big extension to POSIX but let dream we have a calendar aware `strftime`; we could then get output of `ls`, `date` or some-other-legacy tool in calendar of choice by just setting some new localization environment variable without changing much code in those tools. Also consider even in same calendar, month names differ between languages ("مهر" is "میزان" in Afghanistan) as they do in Gregorian calendar and we already have this language specific translations for Gregorian calendar in locales' definition files, so we could extend them for new calendars.
What is the use of ICU having nong-Gregorian support? When, for example, no majorDBMS vendor (Free or not) supports ICU calendaring in its connection library.And there is no major programming framework (Qt for example) have integratedcalendaring in their date/time API or GUI elements.
May be there is no pressing need for the DBMSes and frameworks to get into that much of detail in so low a level in the tech stack?
For instance, I don't store my date/times as Solar Hijri in datastores. I store them as epoch and convert them (with adequate caching) based on users' selected locales and TZs.
What is your common use-case of "ICU calendaring" in datastore connector?
I totally understand the decision by the architects of those frameworks to not to get involved with i18n.
For instance, I don't store my date/times as Solar Hijri in datastores. I store them as epoch and convert them (with adequate caching) based on users' selected locales and TZs.What do you mean by "I don't store my date/times as Solar Hijri"? You don'tstore date/time in any specific calendar. There is no calendaring concept inDBMS time fields. Underlying database engine stores date and time in epochdelta. You "tell" the connector library (not DBMS) to store your date and timeand it converts it to epoch delta and sends it to DBMS in binary format. Theconnector library parses SQL statements and generates epoch delta from**Gregorian** calendar:
It could have been:INSERT INTO table VALUES ('sample string', FROM_SOLARH('1369-07-14')) ; -- Stores 2458032 too
You see? I *HAVE TO*
That's not true. Not only some DBs coming with datetime type store
time in calendrical form, at-least one of them gives you a choice
between calendars (like Solar Hijri); It's Oracle!
In MySQL, you can just use MONTH function on date field and I think
It's optimized because It just needs a mask to get month number.
1: Though It's not much flexible, you can have just one calendar in
whole DB instance.
That is correct if one chooses to use "DBMS time fields" (DATETIME type or alike), but that's not what I was intending to exhibit. What I wanted to show was that one doesn't have to rely at all on database engine or connector library for any logic in dealing with time and date data.
Let's assume that I actually choose to store stuff in DATETIME in my DB, then what I prefer to do is to store everything in Gregorian and convert on retrieval with the libraries I use.
I wanna stress this a bit because It's the point everything go nasty.
There is a big difference between using calendrical form and timestamp
and It's calendars are based on governments laws and are subject to
change, for example, In Iran we swapped using or not using day light
saving couple of times in a half decade. At some point your application
may need to be updated according to law changes, but application
libraries are much easier and more likely to change in time than
databases. It's much easier to update `pytz` than MySQL in a update
procedure and It's more likely to actually do the necessary change.
So if you happen to make a critical system, you may want consider
these things. It may be better just do little or nothing calendaring
stuff in DB, just store timestamp in DB and cache everything you want
in other fields. Make a correct system and then optimize it by what you
have, It's my choice.
one DOES have to rely on database engine or connector library for SOMElogic in dealing with time and date data: How can we use aggregate functions(which is widely used in reporting) on date-time fields?
The problem is not conversion. We all can do conversions. Having calendaring inyour application side, you will have to provide code for logic which its naturalplace is within data layer. I don't even mention performance issues...
Sure. Use it if you think you have to. I'm more in agreement with what Ameretat Reith mentioned, and prefer to stick to calendar-aware, reporting helpers implemented in higher technology stack layers.
"natural"? Having rules of thumb of abstraction in mind, I'd say that having calendarical conversion logic in the DB engine is probably the least "natural" place for that logic. I would like to isolate my data from the irregularities of calendrical systems (e.g. countries switch calendars, they might even have more than one and values in all of different calendars are required in some situations).
Re: Performance. If you rely on a single conversion channel in your application for the any sort of data conversion with no caching and no distributed processing power, of course, you should expect performance issues. Distributed big-data technologies/libraries like Presto are your friends.
So... Let's handle my little unimportant case before climbing clouds:I have a small road-management monitoring software on an 8 core Windows Servermachine, having its MySQL database on same installation. Windows..., 16GBRAM..., Low-Speed HDD... I don't have cloud and I can't connect roadadministration station to high speed internet. The query that I wrote for yearlyreporting is 100x times slower for solar Hijri Calendar.