golang上的公历日历包

I m wrking on a project, and I want to make a date variable with the gregorian calendar in goLang, I've searched about it, but i didn't found an answer here is what i want to do with in golang in a java type code

try {
                final Calendar gc = new GregorianCalendar();
                gc.setTime(simpleDateFormat.parse(callEndDateTime));
                gc.add(Calendar.SECOND, -1 * duration);
                callStartDateTime = simpleDateFormat.format(gc.getTime());
            } catch (final ParseException parseException) {
                LOGGER.error("Couldn't parse the given date: " + callEndDateTime, parseException);
                callStartDateTime = null;
            }

thanks for helping me!

You can make it as a string variable and than parse it.

string strDate = "07 31 2017"; //example
DateFormat df = new SimpleDateFormat("dd MM yyyy");
Date date = df.parse(strDate);
Calendar cal =  new GregorianCalendar();
cal.setTime(date);

The time package always assumes you're working with a Gregorian calendar, as shown in the documentation

Now if you want to parse a date time in golang it's rather simple but you have to keep in mind that the date parser isn't using the "standard" way of defining date formats.

You can see an example of how to use the time parser in the official documentation

const longForm = "Jan 2, 2006 at 3:04pm (MST)"
t, _ := time.Parse(longForm, "Feb 3, 2013 at 7:54pm (PST)")
fmt.Println(t)

That's how you parse a string into a date in go. Converting a date to a string is even simpler :

t.Format("2006-01-02")

See the documentation for more information