Question: SOLVE THIS PROBLEM USING ARRAYS and STRINGS... IN C++ The format of a date needs to be changed in the following manner: 1st Mar 1984
SOLVE THIS PROBLEM USING ARRAYS and STRINGS... IN C++
The format of a date needs to be changed in the following manner: 1st Mar 1984 => 1984-03-01
Write a function 'ReformatDate' which will take the input String and returns the new format of the string.
String ReformatDate(String oldDate);
Example:
1st Mar 1984 => 1984 - 03 - 01
2nd Feb 2013 => 2013 - 02 - 02
15th Apr 1840 => 1840 - 04 - 15
The 'Day' may equal any one of the following values:
1st, 2nd, 3rd, 4th, 5th, 6th, 7th, 8th, 9th,.......29th, 30th, 31st
The 'Month' may equal any one of the following values:
Jan, Feb, Mar, Apr, May, Jun, Jul, Aug, Sep, Oct, Nov, Dec
The Year will always be represented by 4 digits and may equal anything between 1900 and 2100, both inclusive.
Your Task is to format the given list of dates in to the following format: YYYY-MM-DD
Where:
YYYY represents the year in 4 digits
MM represents the year in 2 digits
DD represents the day in 2 digits
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
