[Tutor] PLEASE HELP

Scharrer, Brianna bscharrer at luc.edu
Thu Apr 12 13:24:18 EDT 2018


Applications of basic language syntax

Date/time string parsing


Time stamps on data are often recorded in the standard ISO date and time format as shown below

yyyy-mm-ddThh:mm:ss

2018-01-02T18:31:16 ----> 6:31pm on January 2, 2018

1999-02-14T21:02:37 ----> 9:02pm on February 14, 1999


Write code that when given a datetime string and outputs a human readable version exactly in the format specified below.

[Morning, Noon, Afternoon, Evening, or Night], X:XX[am or pm] on [Month as a word] [day], [year]

E.g. 1999-02-14T21:02:37 would be “Night, 9:02pm on February 14, 1999”

Do not use any datetime string function, though depending on your language they would be useful to do this in practice.

Hint: you’ll have to cast strings to integers in order to perform the if statements which place [Morning, Noon…], [am or pm] and [Month as a word] appropriately.




More information about the Tutor mailing list