Skip to main content
We’ve updated our Terms of Service. A new AI Addendum clarifies how Stack Overflow utilizes AI interactions.
Code Golf

Return to Answer

Saved a huge chunk thanks to TessellatingHeckler's regex golfing.
Source Link
AdmBorkBork
  • 43.7k
  • 5
  • 107
  • 288

PowerShell, (削除) 91 (削除ここまで) (削除) 89 (削除ここまで) 91(削除) 91 (削除ここまで) 56 bytes

date("$args"-replace'th|rd|st|(sun|mon|tues|wednes|thurs|fri|satur\b.*)day(day|,)*'')-f 'yyyyyyyy/MM/dd'dd

Try it online! Try it online!

Takes input as a string. Uses a -replace to get rid of junk, then uses the built-in Get-Date command with the -format flag to specify the required yyyy/MM/dd format. That string is left on the pipeline and output is implicit.

Saved two bytes thanks to Mr Xcoder. Lost two bytes dueSaved a huge chunk thanks to s/sat/saturTessellatingHeckler's regex golfing.

PowerShell, (削除) 91 (削除ここまで) (削除) 89 (削除ここまで) 91 bytes

date("$args"-replace'th|rd|st|(sun|mon|tues|wednes|thurs|fri|satur)day(,)*')-f 'yyyy/MM/dd'

Try it online!

Takes input as a string. Uses a -replace to get rid of junk, then uses the built-in Get-Date command with the -format flag to specify the required yyyy/MM/dd format. That string is left on the pipeline and output is implicit.

Saved two bytes thanks to Mr Xcoder. Lost two bytes due to s/sat/satur

PowerShell, (削除) 91 (削除ここまで) (削除) 89 (削除ここまで) (削除) 91 (削除ここまで) 56 bytes

date("$args"-replace'th|rd|st|(\b.*)day|,')-f yyyy/MM/dd

Try it online!

Takes input as a string. Uses a -replace to get rid of junk, then uses the built-in Get-Date command with the -format flag to specify the required yyyy/MM/dd format. That string is left on the pipeline and output is implicit.

Saved two bytes thanks to Mr Xcoder. Saved a huge chunk thanks to TessellatingHeckler's regex golfing.

s/sat/satur
Source Link
AdmBorkBork
  • 43.7k
  • 5
  • 107
  • 288

PowerShell, (削除) 91 (削除ここまで) 89(削除) 89 (削除ここまで) 91 bytes

date("$args"-replace'th|rd|st|(sun|mon|tues|wednes|thurs|fri|satsun|mon|tues|wednes|thurs|fri|satur)day(,)*')-f 'yyyy/MM/dd'

Try it online! Try it online!

Takes input as a string. Uses a -replace to get rid of junk, then uses the built-in Get-Date command with the -format flag to specify the required yyyy/MM/dd format. That string is left on the pipeline and output is implicit.

Saved two bytes thanks to Mr Xcoder. Lost two bytes due to s/sat/satur

PowerShell, (削除) 91 (削除ここまで) 89 bytes

date("$args"-replace'th|rd|st|(sun|mon|tues|wednes|thurs|fri|sat)day(,)*')-f 'yyyy/MM/dd'

Try it online!

Takes input as a string. Uses a -replace to get rid of junk, then uses the built-in Get-Date command with the -format flag to specify the required yyyy/MM/dd format. That string is left on the pipeline and output is implicit.

Saved two bytes thanks to Mr Xcoder.

PowerShell, (削除) 91 (削除ここまで) (削除) 89 (削除ここまで) 91 bytes

date("$args"-replace'th|rd|st|(sun|mon|tues|wednes|thurs|fri|satur)day(,)*')-f 'yyyy/MM/dd'

Try it online!

Takes input as a string. Uses a -replace to get rid of junk, then uses the built-in Get-Date command with the -format flag to specify the required yyyy/MM/dd format. That string is left on the pipeline and output is implicit.

Saved two bytes thanks to Mr Xcoder. Lost two bytes due to s/sat/satur

Saved two bytes thanks to Mr Xcoder
Source Link
AdmBorkBork
  • 43.7k
  • 5
  • 107
  • 288

PowerShell, 91(削除) 91 (削除ここまで) 89 bytes

date("$args"-replace'th|rd|st|(sun|mon|tues|wednes|thurs|fri|sat)day(,)*')-f 'yyyy/MM/dd'

Try it online!

Takes input as a string. Uses a -replace to get rid of junk, then uses the built-in Get-Date command with the -format flag to specify the required yyyy/MM/dd format. That string is left on the pipeline and output is implicit.

Try it online! Saved two bytes thanks to Mr Xcoder.

PowerShell, 91 bytes

date("$args"-replace'th|rd|st|(sun|mon|tues|wednes|thurs|fri|sat)day(,)*')-f 'yyyy/MM/dd'

Takes input as a string. Uses a -replace to get rid of junk, then uses the built-in Get-Date command with the -format flag to specify the required yyyy/MM/dd format. That string is left on the pipeline and output is implicit.

Try it online!

PowerShell, (削除) 91 (削除ここまで) 89 bytes

date("$args"-replace'th|rd|st|(sun|mon|tues|wednes|thurs|fri|sat)day(,)*')-f 'yyyy/MM/dd'

Try it online!

Takes input as a string. Uses a -replace to get rid of junk, then uses the built-in Get-Date command with the -format flag to specify the required yyyy/MM/dd format. That string is left on the pipeline and output is implicit.

Saved two bytes thanks to Mr Xcoder.

Source Link
AdmBorkBork
  • 43.7k
  • 5
  • 107
  • 288
Loading

AltStyle によって変換されたページ (->オリジナル) /