Below is a Go program that takes a year, month and day values as input, creates a date using those values, and uses the now variable to represent the current time.
Your task is to compare the date and now variables using the After() and Sub() functions and print a string according to the following conditions:
-
"This date will be in the future"— if the inputdateis any date after the current time (now); -
"This date was in the past hundred years"— if the time difference betweennowanddateis less than the currentcenturyDuration; -
"It was a long time ago"— if none of the above conditions are met.