On Thu, Mar 30, 2017 at 8:21 AM, Shaun Cutts <shauncu...@factfiber.com> wrote:
> > My use case is to convert the name of a day to a day of the week number — > now testing in English, but ultimately locale insensitive, so relying on > to_date() to recognize the day in whatever the database locale is. > > Patches are welcome but I'd suggest that you not attempt to incorporate this behavior into to_date. That function returns a date and what you want is a normalized integer (or, in reverse, a locale-specific string). Both locale-specific so stable, not immutable: day_of_week(text) : integer day_of_week(integer) : text Given that "select to_char(now(), 'Day')" works there should be few, if any, technical barriers to overcome. You'd need to decide whether to support only the "ISO 8601" numbering scheme (1-7) or to add additional arguments and/or function to number Sunday as 0 instead of 7. David J.