From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=unavailable autolearn_force=no version=3.4.4 Path: buffer2.nntp.dca1.giganews.com!border2.nntp.dca1.giganews.com!nntp.giganews.com!usenet.blueworldhosting.com!feeder01.blueworldhosting.com!feeder.erje.net!1.eu.feeder.erje.net!eternal-september.org!feeder.eternal-september.org!mx02.eternal-september.org!.POSTED!not-for-mail From: Natasha Kerensikova Newsgroups: comp.lang.ada Subject: Time_Zone-aware Day_of_Week ? Date: Mon, 13 Jul 2015 13:26:20 +0000 (UTC) Organization: A noiseless patient Spider Message-ID: Injection-Date: Mon, 13 Jul 2015 13:26:20 +0000 (UTC) Injection-Info: mx02.eternal-september.org; posting-host="eab84d932a0f4c9d4606240766f0f5e7"; logging-data="30809"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+/G+YeUc/AYB/w+q7E228C" User-Agent: slrn/1.0.2 (FreeBSD) Cancel-Lock: sha1:seAOHibqhN/7rOj5zuLdL1PFFbk= Xref: number.nntp.giganews.com comp.lang.ada:194108 Date: 2015-07-13T13:26:20+00:00 List-Id: Hello, I was implementing some human time formatting with the help of Ada 2005 standard package Ada.Calendar.Formatting, and realized I have an issue with the function Day_of_Week with regards to time zone. Everything else in Ada.Calendar.Formatting seems to support some user-defined time offset, but not Day_of_Week. Is there a particular reason for that? Moreover, the description in the ARM of the function is quite terse: "Returns the day of the week for Time. This is based on the Year, Month, and Day values of Time." However, all of Year, Month and Day functions do have the Time_Zone argument that Day_of_Week lacks. So which time offset is Day_of_Week supposed to use? Prying into GNAT's implementation, it seems to use standard system timezone, but can it be deduced from the ARM? Is there a workaround to still get a Day_of_Week result that is consistent with a user-given time offset? I'm currently leaning towards using Ada.Calendar.Arithmetic.Difference with a reference date, at midnight in the request time zone, but that feels a bit inelegant. Is there a better way of doing it? Thanks for your help, Natasha