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 Question

Commonmark migration
Source Link

Convert short date format into English long date in as few bytes as possible.

#Input

Input

Input will be in the form of a string with format, yyyy-mm-dd, with zero padding optional for all values. You can assume that this is syntactically correct, but not necessarily a valid date. Negative year values do not need to be supported.

#Output

Output

You must convert the date into the English long date format (e.g. 14th February 2017). Zero padding here is not allowed.

If the date is invalid (e.g. 2011-02-29), then this must be recognised in some way. Throwing an exception is allowed.

More examples can be seen below.

#Test Cases

Test Cases

"1980年05月12日" -> 12th May 1980
"2005年12月3日" -> 3rd December 2005
"150-4-21" -> 21st April 150
"2011-2-29" -> (error/invalid)
"1999-10-35" -> (error/invalid)

Convert short date format into English long date in as few bytes as possible.

#Input

Input will be in the form of a string with format, yyyy-mm-dd, with zero padding optional for all values. You can assume that this is syntactically correct, but not necessarily a valid date. Negative year values do not need to be supported.

#Output

You must convert the date into the English long date format (e.g. 14th February 2017). Zero padding here is not allowed.

If the date is invalid (e.g. 2011-02-29), then this must be recognised in some way. Throwing an exception is allowed.

More examples can be seen below.

#Test Cases

"1980年05月12日" -> 12th May 1980
"2005年12月3日" -> 3rd December 2005
"150-4-21" -> 21st April 150
"2011-2-29" -> (error/invalid)
"1999-10-35" -> (error/invalid)

Convert short date format into English long date in as few bytes as possible.

Input

Input will be in the form of a string with format, yyyy-mm-dd, with zero padding optional for all values. You can assume that this is syntactically correct, but not necessarily a valid date. Negative year values do not need to be supported.

Output

You must convert the date into the English long date format (e.g. 14th February 2017). Zero padding here is not allowed.

If the date is invalid (e.g. 2011-02-29), then this must be recognised in some way. Throwing an exception is allowed.

More examples can be seen below.

Test Cases

"1980年05月12日" -> 12th May 1980
"2005年12月3日" -> 3rd December 2005
"150-4-21" -> 21st April 150
"2011-2-29" -> (error/invalid)
"1999-10-35" -> (error/invalid)
Tweeted twitter.com/StackCodeGolf/status/880708895454396416
added 34 characters in body
Source Link
Gareth
  • 1.3k
  • 1
  • 8
  • 14

Convert short date format into English long date in as few bytes as possible.

#Input

Input will be in the form of a string with format, yyyy-mm-dd, with zero padding optional for all values. You can assume that this is syntactically correct, but not necessarily a valid date. Negative year values do not need to be supported.

#Output

You must convert the date into the English long date format (e.g. 14th February 2017). Zero padding here is not allowed.

If the date is invalid (e.g. 2011-02-29), then this must be recognised in some way. Throwing an exception is allowed.

More examples can be seen below.

#Test Cases

"1980年05月12日" -> 12th May 1980
"2005年12月3日" -> 3rd December 2005
"150-4-21" -> 21st April 150
"2011-2-29" -> (error/invalid)
"1999-10-35" -> (error/invalid)

Convert short date format into English long date in as few bytes as possible.

#Input

Input will be in the form of a string with format, yyyy-mm-dd, with zero padding optional for all values. You can assume that this is syntactically correct, but not necessarily a valid date. Negative year values do not need to be supported.

#Output

You must convert the date into the English long date format (e.g. 14th February 2017).

If the date is invalid (e.g. 2011-02-29), then this must be recognised in some way. Throwing an exception is allowed.

More examples can be seen below.

#Test Cases

"1980年05月12日" -> 12th May 1980
"2005年12月3日" -> 3rd December 2005
"150-4-21" -> 21st April 150
"2011-2-29" -> (error/invalid)
"1999-10-35" -> (error/invalid)

Convert short date format into English long date in as few bytes as possible.

#Input

Input will be in the form of a string with format, yyyy-mm-dd, with zero padding optional for all values. You can assume that this is syntactically correct, but not necessarily a valid date. Negative year values do not need to be supported.

#Output

You must convert the date into the English long date format (e.g. 14th February 2017). Zero padding here is not allowed.

If the date is invalid (e.g. 2011-02-29), then this must be recognised in some way. Throwing an exception is allowed.

More examples can be seen below.

#Test Cases

"1980年05月12日" -> 12th May 1980
"2005年12月3日" -> 3rd December 2005
"150-4-21" -> 21st April 150
"2011-2-29" -> (error/invalid)
"1999-10-35" -> (error/invalid)
deleted 2 characters in body; added 1 character in body
Source Link
Gareth
  • 1.3k
  • 1
  • 8
  • 14

Convert short date format into English long date in as few bytes as possible.

#Input

Input will be in the form of a string with format, yyyy-mm-dd, with zero padding optional for all values. You can assume that this is syntactically correct, but not necessarily a valid date. Negative year values do not need to be supported.

#Output

You must convert the date into the English long date format (e.g. 14th February 2017).

If the date is invalid (e.g. 2011-02-29), then this must be recognised in some way. Throwing an exception is allowed.

More examples can be seen below.

#Test Cases

"1980年05月12日" -> 12th May 1980
"2005年12月3日" -> 3rd December 2005
"2002"150-4-21" -> 21st April 2002150
"2011-2-29" -> (error/invalid)
"1999-10-35" -> (error/invalid)

Convert short date format into English long date in as few bytes as possible.

#Input

Input will be in the form of a string with format, yyyy-mm-dd, with zero padding optional for all values. You can assume that this is syntactically correct, but not necessarily a valid date. Negative year values do not need to be supported.

#Output

You must convert the date into the English long date format (e.g. 14th February 2017).

If the date is invalid (e.g. 2011-02-29), then this must be recognised in some way. Throwing an exception is allowed.

More examples can be seen below.

#Test Cases

"1980年05月12日" -> 12th May 1980
"2005年12月3日" -> 3rd December 2005
"2002-4-21" -> 21st April 2002
"2011-2-29" -> (error/invalid)
"1999-10-35" -> (error/invalid)

Convert short date format into English long date in as few bytes as possible.

#Input

Input will be in the form of a string with format, yyyy-mm-dd, with zero padding optional for all values. You can assume that this is syntactically correct, but not necessarily a valid date. Negative year values do not need to be supported.

#Output

You must convert the date into the English long date format (e.g. 14th February 2017).

If the date is invalid (e.g. 2011-02-29), then this must be recognised in some way. Throwing an exception is allowed.

More examples can be seen below.

#Test Cases

"1980年05月12日" -> 12th May 1980
"2005年12月3日" -> 3rd December 2005
"150-4-21" -> 21st April 150
"2011-2-29" -> (error/invalid)
"1999-10-35" -> (error/invalid)
deleted 2 characters in body; added 37 characters in body; added 3 characters in body
Source Link
Gareth
  • 1.3k
  • 1
  • 8
  • 14
Loading
Source Link
Gareth
  • 1.3k
  • 1
  • 8
  • 14
Loading

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