Skip to main content
deleted 17 characters in body
Source Link
hyperneutrino
  • 42.6k
  • 5
  • 68
  • 224

Python 3, 185109 bytes

import calendar asfrom c,datetime as dimport*
T=tuplei=input(map)
z=date(*map(int,input()i.split('-')))
d=d.date(*T)
r=746841600
z=c.timegm(T+toordinal(0,)*3)-727806
print([d.isoformat()[i,'1993- 09-'+str((z-r)//86400+1).zfill(2)][z>r] %d'%z][z>9])

Try it online!Try it online!

-59 bytes thanks to notjagan
-3 bytes thanks to Mr. Xcoder
-2 bytes thanks to officialaimm
-12 bytes thanks to Jonathan Allan

Python 3, 185 bytes

import calendar as c,datetime as d
T=tuple(map(int,input().split('-')))
d=d.date(*T)
r=746841600
z=c.timegm(T+(0,)*3)
print([d.isoformat(),'1993-09-'+str((z-r)//86400+1).zfill(2)][z>r])

Try it online!

Python 3, 109 bytes

from datetime import*
i=input()
z=date(*map(int,i.split())).toordinal()-727806
print([i,'1993 09 %d'%z][z>9])

Try it online!

-59 bytes thanks to notjagan
-3 bytes thanks to Mr. Xcoder
-2 bytes thanks to officialaimm
-12 bytes thanks to Jonathan Allan

deleted 1776 characters in body
Source Link
hyperneutrino
  • 42.6k
  • 5
  • 68
  • 224

Python 3, 182185 bytes

import calendar as c,datetime as d
T=tuple(map(int,input().split('-')))
d=d.date(*T)
r=746841600
z=c.timegm(T+(0,)*3)
print([d.isoformat(),'1993-09-'+str((z-r)//86400+1).zfill(2)][z>r])

Try it online!Try it online!

Explanation

import calendar as c,                                                # `calendar` module is to get the timestamp
                     datetime as d                                   # `datetime` module is to get the format and I/O
T=tuple(                                                             # Get the timetuple
        map(int,                                                     # Map                             to ints
                input().split()))                                    #     the inputs, split by spaces
d=d.date(*T)                                                         # Convert the timetuple to a `datetime` object
r=746841600                                                          # Timestamp of September 1, 1993
z=c.timegm(T+(0,)*3)                                                 # Timestamp of the entered date
print(                                                               # Print the final result
      [d.isoformat(),                                                # The YYYY-MM-DD format of the date
                     '1993-09-'+                                     # 1993-09-
                                str(                                 # Convert to string to zfill
                                    (z-r)//86400+1                   # The difference between the current date and September 1, 1993, divided by the number of seconds in a day, +1
                                                  ).zfill(2)         # Make sure the date is at least 2 digits long
                                                            ][z>r])  # Original date if the date is before the threshold; otherwise, the eternally September date

Python 3, 182 bytes

import calendar as c,datetime as d
T=tuple(map(int,input().split()))
d=d.date(*T)
r=746841600
z=c.timegm(T+(0,)*3)
print([d.isoformat(),'1993-09-'+str((z-r)//86400+1).zfill(2)][z>r])

Try it online!

Explanation

import calendar as c,                                                # `calendar` module is to get the timestamp
                     datetime as d                                   # `datetime` module is to get the format and I/O
T=tuple(                                                             # Get the timetuple
        map(int,                                                     # Map                             to ints
                input().split()))                                    #     the inputs, split by spaces
d=d.date(*T)                                                         # Convert the timetuple to a `datetime` object
r=746841600                                                          # Timestamp of September 1, 1993
z=c.timegm(T+(0,)*3)                                                 # Timestamp of the entered date
print(                                                               # Print the final result
      [d.isoformat(),                                                # The YYYY-MM-DD format of the date
                     '1993-09-'+                                     # 1993-09-
                                str(                                 # Convert to string to zfill
                                    (z-r)//86400+1                   # The difference between the current date and September 1, 1993, divided by the number of seconds in a day, +1
                                                  ).zfill(2)         # Make sure the date is at least 2 digits long
                                                            ][z>r])  # Original date if the date is before the threshold; otherwise, the eternally September date

Python 3, 185 bytes

import calendar as c,datetime as d
T=tuple(map(int,input().split('-')))
d=d.date(*T)
r=746841600
z=c.timegm(T+(0,)*3)
print([d.isoformat(),'1993-09-'+str((z-r)//86400+1).zfill(2)][z>r])

Try it online!

added 1714 characters in body
Source Link
hyperneutrino
  • 42.6k
  • 5
  • 68
  • 224

Explanation

import calendar as c,                                                # `calendar` module is to get the timestamp
                     datetime as d                                   # `datetime` module is to get the format and I/O
T=tuple(                                                             # Get the timetuple
        map(int,                                                     # Map                             to ints
                input().split()))                                    #     the inputs, split by spaces
d=d.date(*T)                                                         # Convert the timetuple to a `datetime` object
r=746841600                                                          # Timestamp of September 1, 1993
z=c.timegm(T+(0,)*3)                                                 # Timestamp of the entered date
print(                                                               # Print the final result
      [d.isoformat(),                                                # The YYYY-MM-DD format of the date
                     '1993-09-'+                                     # 1993-09-
                                str(                                 # Convert to string to zfill
                                    (z-r)//86400+1                   # The difference between the current date and September 1, 1993, divided by the number of seconds in a day, +1
                                                  ).zfill(2)         # Make sure the date is at least 2 digits long
                                                            ][z>r])  # Original date if the date is before the threshold; otherwise, the eternally September date

Explanation

import calendar as c,                                                # `calendar` module is to get the timestamp
                     datetime as d                                   # `datetime` module is to get the format and I/O
T=tuple(                                                             # Get the timetuple
        map(int,                                                     # Map                             to ints
                input().split()))                                    #     the inputs, split by spaces
d=d.date(*T)                                                         # Convert the timetuple to a `datetime` object
r=746841600                                                          # Timestamp of September 1, 1993
z=c.timegm(T+(0,)*3)                                                 # Timestamp of the entered date
print(                                                               # Print the final result
      [d.isoformat(),                                                # The YYYY-MM-DD format of the date
                     '1993-09-'+                                     # 1993-09-
                                str(                                 # Convert to string to zfill
                                    (z-r)//86400+1                   # The difference between the current date and September 1, 1993, divided by the number of seconds in a day, +1
                                                  ).zfill(2)         # Make sure the date is at least 2 digits long
                                                            ][z>r])  # Original date if the date is before the threshold; otherwise, the eternally September date
Source Link
hyperneutrino
  • 42.6k
  • 5
  • 68
  • 224
Loading