13052 - ISO-8601   

Description

Please write a C++ Program to turn a string of numbers separated by commas, into ISO-8601 format.

 

ISO-8601

  • The format is: yyyy-mm-ddThh:mm:ssZ.
  • Use capital ‘T’ to separate date information and time information.
  • Z represents the GMT time-zone, when the time-zone is GMT+8 than Z = +8. Usually use capital ‘Z’ to represent the GMT+0.

 

note that, you may use std::setfill(char) and std::setw(int) to help printing time in format.

 

Example:

#include <iostream> // std::cout
#include <iomanip> // std::setfill, std::setw
 
std::cout << std::setfill(‘-’)  << std::setw(4) << 35; // --35

 

if you don’t know how to use them, feel free to use your own method.

Input

A string of seven numbers separated by commas, represents year, month, day, hour, minute, second, time-zone respectively. For examples: “2020,12,10,21,6,17,8

note that year may be smaller 1000, but would not be larger than 9999. For example year = 525, year = 0, year 1995.

Output

Output should follow as below format:

yyyy-mm-ddThh:mm:ssZ

Sample Input  Download

Sample Output  Download

Tags




Discuss