Skip to main content
added 44 characters in body
Source Link
jqkul
  • 2.3k
  • 1
  • 18
  • 24

Python 3, 70 bytes

from time import*
lambda s:strftime("%b%y",strptime(s,"%Y%m")).upper()

This uses the built-in strftime and strptime functions.

For 2 bytes1 byte more, here's a version which parses the string manually:

lambda s:"JFMAMJJASONDAEAPAUUUECOENBRRYNLGPTVC"[int" JFMAMJJASONDAEAPAUUUECOENBRRYNLGPTVC"[int(s[4:])-1::12]+s[2:4]

This encodes the month names in an interesting way (thanks to Henry Gomersall for saving a byte).

Python 3, 70 bytes

from time import*
lambda s:strftime("%b%y",strptime(s,"%Y%m")).upper()

This uses the built-in strftime and strptime functions.

For 2 bytes more, here's a version which parses the string manually:

lambda s:"JFMAMJJASONDAEAPAUUUECOENBRRYNLGPTVC"[int(s[4:])-1::12]+s[2:4]

This encodes the month names in an interesting way.

Python 3, 70 bytes

from time import*
lambda s:strftime("%b%y",strptime(s,"%Y%m")).upper()

This uses the built-in strftime and strptime functions.

For 1 byte more, here's a version which parses the string manually:

lambda s:" JFMAMJJASONDAEAPAUUUECOENBRRYNLGPTVC"[int(s[4:])::12]+s[2:4]

This encodes the month names in an interesting way (thanks to Henry Gomersall for saving a byte).

added a period at end
Source Link
jqkul
  • 2.3k
  • 1
  • 18
  • 24

Python 3, 70 bytes

from time import*
lambda s:strftime("%b%y",strptime(s,"%Y%m")).upper()

This uses the built-in strftime and strptime functions.

For 2 bytes more, here's a version which parses the string manually:

lambda s:"JFMAMJJASONDAEAPAUUUECOENBRRYNLGPTVC"[int(s[4:])-1::12]+s[2:4]

This encodes the month names in an interesting way.

Python 3, 70 bytes

from time import*
lambda s:strftime("%b%y",strptime(s,"%Y%m")).upper()

This uses the built-in strftime and strptime functions.

For 2 bytes more, here's a version which parses the string manually:

lambda s:"JFMAMJJASONDAEAPAUUUECOENBRRYNLGPTVC"[int(s[4:])-1::12]+s[2:4]

This encodes the month names in an interesting way

Python 3, 70 bytes

from time import*
lambda s:strftime("%b%y",strptime(s,"%Y%m")).upper()

This uses the built-in strftime and strptime functions.

For 2 bytes more, here's a version which parses the string manually:

lambda s:"JFMAMJJASONDAEAPAUUUECOENBRRYNLGPTVC"[int(s[4:])-1::12]+s[2:4]

This encodes the month names in an interesting way.

Source Link
jqkul
  • 2.3k
  • 1
  • 18
  • 24

Python 3, 70 bytes

from time import*
lambda s:strftime("%b%y",strptime(s,"%Y%m")).upper()

This uses the built-in strftime and strptime functions.

For 2 bytes more, here's a version which parses the string manually:

lambda s:"JFMAMJJASONDAEAPAUUUECOENBRRYNLGPTVC"[int(s[4:])-1::12]+s[2:4]

This encodes the month names in an interesting way