가이아 , 78 바이트
ℍZ¤∨4Ė
:'//d¦[1993₉31];>\{\‡:(…1993>↑¦365+¦¤ṇ↑∂K∂k,=;((<¤)-243]_ḥΣ“1993/09/”¤+}?
온라인으로 사용해보십시오!
설명
첫째, 우리는 연도가 윤년인지를 결정하는 도우미 기능을 가지고 있습니다.
ℍ 100
Z Divmod year by 100, pushing the first 2 digits, then the second 2 digits
¤ Swap
∨ Logical OR, gives the left-most non-zero number
4Ė Check for divisibility by 4
주요 기능은 나머지 작업을 수행합니다.
: Push two copies of the input.
'// Split the top on on slashes.
d¦ Parse each section as a number.
[1993₉31] Push the list [1993 9 31].
;> Copy the date and check if its less than that.
\ If it is, delete the list and leave the input string on top.
{ Else:
:( Copy the date and get the year.
…1993> Get the range from 1993 to year-1.
↑¦365+¦ Map each to 365+(whether it's a leap year).
¤ Swap, bring the date back to the top.
ṇ↑ Pull out the year and check if it's a leap year.
∂K∂k, Push the pair of lists [[days in months in a leap year] [days in months]]
= Index the result of checking if the year is a leap year into the pair.
;((< Get the first (month number - 1) elements.
¤ Swap, bring date back to the top.
) Get the day.
-243 Push -243 (243 is the number of days between Jan 1 1993 and Sept 1 1993).
] Wrap everything in a list.
_ Flatten the list.
ḥ Remove the first element (the input string).
Σ Sum it.
“1993/09/”¤+ Append the resulting number to "1993/09/".
}? (end if)
Implicitly display whatever is on top of the stack.