×ばつ(¢Ẓd60 - Link 1, get hours and minutes portion of days: number (of days)
%1 - modulo by one - get the fractional part
(¢Ẓ - base 250 number = 1440 (that's 60*24)
×ばつ - multiply
d60 - divmod 60 (integer divide by sixty and yield result and remainder)
_"#ḟf’_.μd364Ad0¦7Ẏ;ÇḞ‘2¦ị3¦"TUWETHFRSASUMO"s2¤Ṛ€o0ẋ(¡Ḳḃ4¤¤U(œọ;"ṢṢ :‘¤Ọ¤żFḊ8Ṡ>-¤¡
- Main link: number, JulianDate -- breaking this down into parts...
_"#ḟf’_.μ - Main link part 1 (get the CMJD): number, JulianDate
"#ḟf’ - base 250 number = 2309103
_ - subtract from JulianDate
_. - subtract a half
μ - monadic chan separation, call that CMJD
d364Ad0¦7Ẏ;ÇḞ‘2¦ - Main link part 2 (get the numeric parts): number, CMJD
d364 - divmod 364 (integer divide by 364 and yield result and remainder)
A - absolute value (removes the sign from the year part)
¦ - sparse application:
0 - ...to index: zero (rightmost - the remainder)
d 7 - ...action: divmod 7 (integer divide by 7 and yield result and remainder)
Ẏ - tighten (to a list of three items)
Ç - call the last link (1) as a monad with argument CMJD
; - concatenate (now we have floats [abs(Y.0), W.0, D.0, H.0, M.x])
Ḟ - floor (vectorises) (yielding ints [abs(Y), W, D, H, M]
¦ - sparse application:
2 - ...to index: 2 (W)
‘ - ...action: increment (CD weeks are 1-indexed, W is 0 indexed)
ị3¦"TUWETHFRSASUMO"s2¤ - Main link part 3 (make the day-string): result of part 2
¦ - sparse application:
3 - ...to index: 3 (D)
ị - ...action: index into:
¤ - nilad followed by link(s) as a nilad:
"TUWETHFRSASUMO" - list of characters = "TUWETHFRSASUMO"
s2 - split into chunks of length two
- (note: D=0 yields "MO" due to 1-based & modular indexing)
Ṛ€o0ẋ(¡Ḳḃ4¤¤U - Main link part 4 (pad parts with zeros): result of part 3
Ṛ€ - reverse each (implicit decimal-list, so reverse of 289 is [9,8,2])
¤ - nilad followed by link(s) as a nilad:
0 - zero
¤ - nilad followed by link(s) as a nilad:
(¡Ḳ - base 250 number = 1178
ḃ4 - convert to bijective-base 4 = [4,2,1,2,2]
ẋ - repeat = [[0,0,0,0],[0,0],[0],[0,0],[0,0]]
o - logical or (vectorises) (yielding the reversed zero padded entries)
U - upend (reverse each - everything is already a list so not Ṛ€)
- now we have something like: [[Ya,Yb,Yc,Yd],[Wa,Wb],['Da','Db'],[ha,hb],[ma,mb]]
(œọ;"ṢṢ :‘¤Ọ¤ż - Main link part 5 (include the separators): result of part 4
¤ - nilad followed by link(s) as a nilad:
¤ - nilad followed by link(s) as a nilad:
(œọ - base 250 literal = 8722
"ṢṢ :‘ - code-page indices = [183,183,32,58]
; - concatenate = [8722,183,183,32,58]
Ọ - covert ordinals to characters = "−·· :"
ż - zip with the result from part 4, i.e. [['−',[Ya,Yb,Yc,Yd]],['·',[Wa,Wb]],['·',['Da','Db']],[' ',[ha,hb]],[':',[ma,mb]]]
FḊ8Ṡ>-¤¡ - Main link part 6 (remove the sign if need be): result from part 5
F - flatten the result from part 5 into a single list: ['−',Ya,Yb,Yc,Yd,'·',Wa,Wb,'·','Da','Db',' ',ha,hb,':',ma,mb]
¡ - repeat:
Ḋ - ...action: dequeue (remove first element)
¤ - ...number of times: nilad followed by link(s) as a nilad:
8 - chain's left argument = CMJD
Ṡ - sign (-1 if less than 0, 0 if equal to 0, 1 if greater than 0)
>- - greater than -1?
- implicit print
×ばつ(¢Ẓd60 - Link 1, get hours and minutes portion of days: number (of days)
%1 - modulo by one - get the fractional part
(¢Ẓ - base 250 number = 1440 (that's 60*24)
×ばつ - multiply
d60 - divmod 60 (integer divide by sixty and yield result and remainder)
_"#ḟf’_.μd364Ad0¦7Ẏ;ÇḞ‘2¦ị3¦"TUWETHFRSASUMO"s2¤Ṛ€o0ẋ(¡Ḳḃ4¤¤U(œọ;"ṢṢ :‘¤Ọ¤żFḊ8Ṡ>-¤¡
- Main link: number, JulianDate -- breaking this down into parts...
_"#ḟf’_.μ - Main link part 1 (get the CMJD): number, JulianDate
"#ḟf’ - base 250 number = 2309103
_ - subtract from JulianDate
_. - subtract a half
μ - monadic chan separation, call that CMJD
d364Ad0¦7Ẏ;ÇḞ‘2¦ - Main link part 2 (get the numeric parts): number, CMJD
d364 - divmod 364 (integer divide by 364 and yield result and remainder)
A - absolute value (removes the sign from the year part)
¦ - sparse application:
0 - ...to index: zero (rightmost - the remainder)
d 7 - ...action: divmod 7 (integer divide by 7 and yield result and remainder)
Ẏ - tighten (to a list of three items)
Ç - call the last link (1) as a monad with argument CMJD
; - concatenate (now we have floats [abs(Y.0), W.0, D.0, H.0, M.x])
Ḟ - floor (vectorises) (yielding ints [abs(Y), W, D, H, M]
¦ - sparse application:
2 - ...to index: 2 (W)
‘ - ...action: increment (CD weeks are 1-indexed, W is 0 indexed)
ị3¦"TUWETHFRSASUMO"s2¤ - Main link part 3 (make the day-string): result of part 2
¦ - sparse application:
3 - ...to index: 3 (D)
ị - ...action: index into:
¤ - nilad followed by link(s) as a nilad:
"TUWETHFRSASUMO" - list of characters = "TUWETHFRSASUMO"
s2 - split into chunks of length two
- (note: D=0 yields "MO" due to 1-based & modular indexing)
Ṛ€o0ẋ(¡Ḳḃ4¤¤U - Main link part 4 (pad parts with zeros): result of part 3
Ṛ€ - reverse each (implicit decimal-list, so reverse of 289 is [9,8,2])
¤ - nilad followed by link(s) as a nilad:
0 - zero
¤ - nilad followed by link(s) as a nilad:
(¡Ḳ - base 250 number = 1178
ḃ4 - convert to bijective-base 4 = [4,2,1,2,2]
U - upend (reverse each - everything is already a list so not Ṛ€)
- now we have something like: [[Ya,Yb,Yc,Yd],[Wa,Wb],['Da','Db'],[ha,hb],[ma,mb]]
(œọ;"ṢṢ :‘¤Ọ¤ż - Main link part 5 (include the separators): result of part 4
¤ - nilad followed by link(s) as a nilad:
¤ - nilad followed by link(s) as a nilad:
(œọ - base 250 literal = 8722
"ṢṢ :‘ - code-page indices = [183,183,32,58]
; - concatenate = [8722,183,183,32,58]
Ọ - covert ordinals to characters = "−·· :"
ż - zip with the result from part 4, i.e. [['−',[Ya,Yb,Yc,Yd]],['·',[Wa,Wb]],['·',['Da','Db']],[' ',[ha,hb]],[':',[ma,mb]]]
FḊ8Ṡ>-¤¡ - Main link part 6 (remove the sign if need be): result from part 5
F - flatten the result from part 5 into a single list: ['−',Ya,Yb,Yc,Yd,'·',Wa,Wb,'·','Da','Db',' ',ha,hb,':',ma,mb]
¡ - repeat:
Ḋ - ...action: dequeue (remove first element)
¤ - ...number of times: nilad followed by link(s) as a nilad:
8 - chain's left argument = CMJD
Ṡ - sign (-1 if less than 0, 0 if equal to 0, 1 if greater than 0)
>- - greater than -1?
- implicit print
×ばつ(¢Ẓd60 - Link 1, get hours and minutes portion of days: number (of days)
%1 - modulo by one - get the fractional part
(¢Ẓ - base 250 number = 1440 (that's 60*24)
×ばつ - multiply
d60 - divmod 60 (integer divide by sixty and yield result and remainder)
_"#ḟf’_.μd364Ad0¦7Ẏ;ÇḞ‘2¦ị3¦"TUWETHFRSASUMO"s2¤Ṛ€o0ẋ(¡Ḳḃ4¤¤U(œọ;"ṢṢ :‘¤Ọ¤żFḊ8Ṡ>-¤¡
- Main link: number, JulianDate -- breaking this down into parts...
_"#ḟf’_.μ - Main link part 1 (get the CMJD): number, JulianDate
"#ḟf’ - base 250 number = 2309103
_ - subtract from JulianDate
_. - subtract a half
μ - monadic chan separation, call that CMJD
d364Ad0¦7Ẏ;ÇḞ‘2¦ - Main link part 2 (get the numeric parts): number, CMJD
d364 - divmod 364 (integer divide by 364 and yield result and remainder)
A - absolute value (removes the sign from the year part)
¦ - sparse application:
0 - ...to index: zero (rightmost - the remainder)
d 7 - ...action: divmod 7 (integer divide by 7 and yield result and remainder)
Ẏ - tighten (to a list of three items)
Ç - call the last link (1) as a monad with argument CMJD
; - concatenate (now we have floats [abs(Y.0), W.0, D.0, H.0, M.x])
Ḟ - floor (vectorises) (yielding ints [abs(Y), W, D, H, M]
¦ - sparse application:
2 - ...to index: 2 (W)
‘ - ...action: increment (CD weeks are 1-indexed, W is 0 indexed)
ị3¦"TUWETHFRSASUMO"s2¤ - Main link part 3 (make the day-string): result of part 2
¦ - sparse application:
3 - ...to index: 3 (D)
ị - ...action: index into:
¤ - nilad followed by link(s) as a nilad:
"TUWETHFRSASUMO" - list of characters = "TUWETHFRSASUMO"
s2 - split into chunks of length two
- (note: D=0 yields "MO" due to 1-based & modular indexing)
Ṛ€o0ẋ(¡Ḳḃ4¤¤U - Main link part 4 (pad parts with zeros): result of part 3
Ṛ€ - reverse each (implicit decimal-list, so reverse of 289 is [9,8,2])
¤ - nilad followed by link(s) as a nilad:
0 - zero
¤ - nilad followed by link(s) as a nilad:
(¡Ḳ - base 250 number = 1178
ḃ4 - convert to bijective-base 4 = [4,2,1,2,2]
ẋ - repeat = [[0,0,0,0],[0,0],[0],[0,0],[0,0]]
o - logical or (vectorises) (yielding the reversed zero padded entries)
U - upend (reverse each - everything is already a list so not Ṛ€)
- now we have something like: [[Ya,Yb,Yc,Yd],[Wa,Wb],['Da','Db'],[ha,hb],[ma,mb]]
(œọ;"ṢṢ :‘¤Ọ¤ż - Main link part 5 (include the separators): result of part 4
¤ - nilad followed by link(s) as a nilad:
¤ - nilad followed by link(s) as a nilad:
(œọ - base 250 literal = 8722
"ṢṢ :‘ - code-page indices = [183,183,32,58]
; - concatenate = [8722,183,183,32,58]
Ọ - covert ordinals to characters = "−·· :"
ż - zip with the result from part 4, i.e. [['−',[Ya,Yb,Yc,Yd]],['·',[Wa,Wb]],['·',['Da','Db']],[' ',[ha,hb]],[':',[ma,mb]]]
FḊ8Ṡ>-¤¡ - Main link part 6 (remove the sign if need be): result from part 5
F - flatten the result from part 5 into a single list: ['−',Ya,Yb,Yc,Yd,'·',Wa,Wb,'·','Da','Db',' ',ha,hb,':',ma,mb]
¡ - repeat:
Ḋ - ...action: dequeue (remove first element)
¤ - ...number of times: nilad followed by link(s) as a nilad:
8 - chain's left argument = CMJD
Ṡ - sign (-1 if less than 0, 0 if equal to 0, 1 if greater than 0)
>- - greater than -1?
- implicit print
Jelly, 92 bytes
Definitely beatable by languages with built-in time-formatting or even just better string-formatting.
×ばつ(¢Ẓd60
_"#ḟf’_.μd364Ad0¦7Ẏ;ÇḞ‘2¦ị3¦"TUWETHFRSASUMO"s2¤Ṛ€o0ẋ(¡Ḳḃ4¤¤U(œọ;"ṢṢ :‘¤Ọ¤żFḊ8Ṡ>-¤¡
A full program accepting a single argument (decimal number representation) and printing the result.
How?
×ばつ(¢Ẓd60 - Link 1, get hours and minutes portion of days: number (of days)
%1 - modulo by one - get the fractional part
(¢Ẓ - base 250 number = 1440 (that's 60*24)
×ばつ - multiply
d60 - divmod 60 (integer divide by sixty and yield result and remainder)
_"#ḟf’_.μd364Ad0¦7Ẏ;ÇḞ‘2¦ị3¦"TUWETHFRSASUMO"s2¤Ṛ€o0ẋ(¡Ḳḃ4¤¤U(œọ;"ṢṢ :‘¤Ọ¤żFḊ8Ṡ>-¤¡
- Main link: number, JulianDate -- breaking this down into parts...
_"#ḟf’_.μ - Main link part 1 (get the CMJD): number, JulianDate
"#ḟf’ - base 250 number = 2309103
_ - subtract from JulianDate
_. - subtract a half
μ - monadic chan separation, call that CMJD
d364Ad0¦7Ẏ;ÇḞ‘2¦ - Main link part 2 (get the numeric parts): number, CMJD
d364 - divmod 364 (integer divide by 364 and yield result and remainder)
A - absolute value (removes the sign from the year part)
¦ - sparse application:
0 - ...to index: zero (rightmost - the remainder)
d 7 - ...action: divmod 7 (integer divide by 7 and yield result and remainder)
Ẏ - tighten (to a list of three items)
Ç - call the last link (1) as a monad with argument CMJD
; - concatenate (now we have floats [abs(Y.0), W.0, D.0, H.0, M.x])
Ḟ - floor (vectorises) (yielding ints [abs(Y), W, D, H, M]
¦ - sparse application:
2 - ...to index: 2 (W)
‘ - ...action: increment (CD weeks are 1-indexed, W is 0 indexed)
ị3¦"TUWETHFRSASUMO"s2¤ - Main link part 3 (make the day-string): result of part 2
¦ - sparse application:
3 - ...to index: 3 (D)
ị - ...action: index into:
¤ - nilad followed by link(s) as a nilad:
"TUWETHFRSASUMO" - list of characters = "TUWETHFRSASUMO"
s2 - split into chunks of length two
- (note: D=0 yields "MO" due to 1-based & modular indexing)
Ṛ€o0ẋ(¡Ḳḃ4¤¤U - Main link part 4 (pad parts with zeros): result of part 3
Ṛ€ - reverse each (implicit decimal-list, so reverse of 289 is [9,8,2])
¤ - nilad followed by link(s) as a nilad:
0 - zero
¤ - nilad followed by link(s) as a nilad:
(¡Ḳ - base 250 number = 1178
ḃ4 - convert to bijective-base 4 = [4,2,1,2,2]
U - upend (reverse each - everything is already a list so not Ṛ€)
- now we have something like: [[Ya,Yb,Yc,Yd],[Wa,Wb],['Da','Db'],[ha,hb],[ma,mb]]
(œọ;"ṢṢ :‘¤Ọ¤ż - Main link part 5 (include the separators): result of part 4
¤ - nilad followed by link(s) as a nilad:
¤ - nilad followed by link(s) as a nilad:
(œọ - base 250 literal = 8722
"ṢṢ :‘ - code-page indices = [183,183,32,58]
; - concatenate = [8722,183,183,32,58]
Ọ - covert ordinals to characters = "−·· :"
ż - zip with the result from part 4, i.e. [['−',[Ya,Yb,Yc,Yd]],['·',[Wa,Wb]],['·',['Da','Db']],[' ',[ha,hb]],[':',[ma,mb]]]
FḊ8Ṡ>-¤¡ - Main link part 6 (remove the sign if need be): result from part 5
F - flatten the result from part 5 into a single list: ['−',Ya,Yb,Yc,Yd,'·',Wa,Wb,'·','Da','Db',' ',ha,hb,':',ma,mb]
¡ - repeat:
Ḋ - ...action: dequeue (remove first element)
¤ - ...number of times: nilad followed by link(s) as a nilad:
8 - chain's left argument = CMJD
Ṡ - sign (-1 if less than 0, 0 if equal to 0, 1 if greater than 0)
>- - greater than -1?
- implicit print