A tiny New Year's programming challenge
|
01-23-2015, 08:25 PM
(This post was last modified: 01-23-2015 08:32 PM by Dieter.)
Post: #24
|
|||
|
|||
RE: A tiny New Year's programming challenge
(01-22-2015 01:50 PM)wynen Wrote: I suppose, I'm a bit late for a "New Year's" programming challenge, but I want to contribute a HP-16C program to convert calender date representations. Thank you very much for your contribution. I do not have access to a 16C, so I cannot try your program. I assume it is based on integer arithmetics. Does it also work for negative (B.C.) years? (01-22-2015 01:50 PM)wynen Wrote: My solution uses a subroutine to convert a (proleptic) Gregorian Calender date YYYY-MM-DD to a Julian Day Number (i.e. the Julian Date as of YYYY-MM-DDT12:00Z). I think it's not mm+12 in the "else" branch, but mm+9. This is also what your program calculates: it first evaluates mm–3 and, if this is <0 (i.e. mm=1..2) it adds 12 back, giving in total mm+9. (01-22-2015 01:50 PM)wynen Wrote: +1, I would say, or use JDN(yyyy-01-00). Otherwise 1 Jan is day 0. (01-22-2015 01:50 PM)wynen Wrote: I think I''ll have to take a closer look at that. Have you tried the examples in my initial post? Dieter |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 1 Guest(s)