| From: | Bruce Momjian <bruce(at)momjian(dot)us> |
|---|---|
| To: | Brendan Jurd <direvus(at)gmail(dot)com> |
| Cc: | Adrian Klaver <adrian(dot)klaver(at)gmail(dot)com>, Steve Crawford <scrawford(at)pinpointresearch(dot)com>, pgsql-general(at)postgresql(dot)org, marc(at)bloodnok(dot)com, hackers(at)postgresql(dot)org |
| Subject: | Re: [HACKERS] Date conversion using day of week |
| Date: | 2012-09-01 21:11:59 |
| Message-ID: | 20120901211159.GB13618@momjian.us |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-general pgsql-hackers |
On Fri, Apr 1, 2011 at 03:58:48AM +1100, Brendan Jurd wrote:
> On 1 April 2011 03:32, Adrian Klaver <adrian(dot)klaver(at)gmail(dot)com> wrote:
> > Now I am confused the docs say:
> >
> > D day of the week, Sunday(1) to Saturday(7)
> > ID ISO day of the week, Monday(1) to Sunday(7)
> >
> > This would seem to say they both are one-based but differ on the day that is
> > 1.
>
> That's correct for the user-facing interpretation. Internally,
> however, Gregorian day-of-week is represented with Sunday = 0. I
> can't see any good reason in the code for why that should be so, but
> it was like that when I found it, and until now I haven't had any
> cause to mess with it.
>
> My suggestion for moving forward basically still stands, though. We'd
> need to standardise the use of TmFromChar.d to either one of the
> 1-based conventions, and convert to the other one as required in
> do_to_timestamp. The Gregorian convention is probably the right
> choice for the standard, even though it has the week starting on a
> Sunday (ridiculous!) because it means less converting for the majority
> of cases.
Yes, I went in the direction you suggested with patch posted in recent
thread.
--
Bruce Momjian <bruce(at)momjian(dot)us> http://momjian.us
EnterpriseDB http://enterprisedb.com
+ It's impossible for everything to be true. +
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Bruce Momjian | 2012-09-01 21:14:39 | Re: [GENERAL] Date conversion using day of week |
| Previous Message | Bruce Momjian | 2012-09-01 21:11:23 | Re: [HACKERS] Date conversion using day of week |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Bruce Momjian | 2012-09-01 21:14:39 | Re: [GENERAL] Date conversion using day of week |
| Previous Message | Bruce Momjian | 2012-09-01 21:11:23 | Re: [HACKERS] Date conversion using day of week |