From: | Chris Browne <cbbrowne(at)acm(dot)org> |
---|---|
To: | pgsql-hackers(at)postgresql(dot)org |
Subject: | Re: Multi calendar system for pgsql |
Date: | 2009-02-18 18:34:56 |
Message-ID: | 87zlgj61bj.fsf@dba2.int.libertyrms.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
m(dot)alimomeni(at)gmail(dot)com (Mohsen Alimomeni) writes:
> I want to try to add a multi calendar system for pgsql. I want to
> know if it will be accepted as a patch to pgsql?
I would expect there to be nearly zero chance of such, at least in the
form of a change to how dates are stored.
As long as there is commonality in epochs and some continuity of
calculations of dates relative to epochs, there shouldn't be any
fundamental problem in adding on functions to do the following sorts
of things:
- Calculate what the UNIX date is for a given date in a given
calendar
- Output a UNIX date in the form indicated by a given calendar
You should avail yourself of the book, _Calendrical Calculations_, by
Edward M Reingold and Nachum Deerschowitz; it presents details of
calculations and conversions of dates between the following calendars:
- Gregorian
- Julian
- Coptic
- Ethiopic
- ISO
- Islamic
- Hebrew
- Ecclesiastical Calendars, for dates of Christian holidays such as Easter
- Old Hindu
- Modern Hindu
- Mayan
- Balinese Pawukon
- Persian
- Baha'i
- French Revolution
- Chinese
It would seem a whole lot preferable to create functions like (and
there may be better names!):
create function parse_date (locale, text) returns timestamp
create function output_date (local, timestamp) returns text
Thus, you might expect the following:
select parse_date('Islamic', 'Miharram 1, AH 1');
parse_date
-------------------------
622-07-16 00:00:00
Or
select output_date('Persian', '622-03-19'::timestamp);
output_date
-------------------------
1 Farvardin AH 1
(It is entirely likely that I'm fracturing spellings of things!
Apologies if I am!)
http://emr.cs.uiuc.edu/home/reingold/calendar-book/index.shtml
--
(reverse (concatenate 'string "moc.enworbbc" "@" "enworbbc"))
http://cbbrowne.com/info/x.html
"Thank you for calling PIXAR! If you have a touch tone phone, you can
get information or reach anybody here easily! If your VCR at home is
still blinking '12:00', press '0' at any time during this message and
an operator will assist you."
-- PIXAR'S toll-free line (1-800-888-9856)
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2009-02-18 18:41:34 | Re: pg_restore new option -m |
Previous Message | Tom Lane | 2009-02-18 18:25:55 | Re: pg_migrator progress |