Template talk:Date from ordinal
From Wikipedia, the free encyclopedia
[edit] Examples
{{date from ordinal|13}} is January 13, should be January 13
{{date from ordinal|43}} is February 12, should be February 12
{{date from ordinal|75}} is March 16, should be March 16
{{date from ordinal|75|leapyear=1}} is March 15, should be March 15
{{date from ordinal|75|1999}} is March 16, should be March 16
{{date from ordinal|75|2000}} is March 15, should be March 15
[edit] Discussion
The template could be speeded up and/or shortened by using arithmetic and if-then constructs. I have something in mind like:
if x <= 31 return x if x <= 59 // 31 + 28 return x - 31 if x <= 90 // 31 + 28 + 31 return x - 59 // etc.
The numbers 31, 28, 31 etc. are the lengths of each month in non-leap years. --Uncle Ed 16:04, 21 April 2006 (UTC)
- see Template talk:Date from ordinal/test where I think I've proven that this new method will work. --Uncle Ed 16:24, 21 April 2006 (UTC)
[edit] Separate day from month
{{
JULIANDAY.DAY |Expression error: Unrecognised punctuation character "{"