Computer scienceProgramming languagesGolangPackages and modulesStandard libraryTime package

Parsing and formatting time

Not simple time format

Report a typo

You get five integer numbers: year, month, day, hour, and minute. Create a variable of the time.Time type with these numbers and print them using the format below (use a two-digit format for single-digit numbers):

-* day | month | year *-\n < hour >< minute >

Remember what exact symbols the RFC3339 template provides. To solve this task, you need to replace the name of the time interval with the correct template mark: for example, replace "year" with 2006 and "hour" with 15:

-* day | month | 2006 *-\n < 15 >< minute >

Sample Input 1:

1946 2 13 12 0

Sample Output 1:

-* 13 | 02 | 1946 *-
   < 12 >< 00 >
Write a program in Go
package main

import (
"fmt"
"time"
)

func main() {
var year, month, day, hour, minute int

fmt.Scan(&year, &?, &?, ?, ?)

date := time.Date(?, ?, ?, ?, ?, 0, 0, time.UTC)

fmt.Println(date.?("-* 02 | ?? | 2006 *-\n < 15 >< ?? >"))
}
___

Create a free account to access the full topic