Date Conversion

September 3, 2019

Where I work, the accounting department does a survey of its vendors once a year, or every three years, or something, I’m not sure of the details. All of the vendors send CSV files with multiple rows, from a few rows to several hundred; each row contains 3 dates. Different vendors send dates in different formats: 9/3/19, 9-3-19, 09/03/2019, 3-SEP-19, “September 3, 2019” (quoted to protect the embedded comma), and even 09/03/2019T14:37:26.8493 (because every ten-thousandth of a second matters). That variety of formats caused problems for the accounting department, so they asked for help in reformatting the dates. Here is some sample data:

Sally,Jackson,3-SEP-19,"September 3, 2019",09/03/2019T14:37:26.8493,200

Your task is to write a program to convert dates from a variety of formats to the standard MM/DD/YYYY format. When you are finished, you are welcome to read or run a suggested solution, or to post your own solution or discuss the exercise in the comments below.


Pages: 1 2