Skip to content

Instantly share code, notes, and snippets.

@pracps
Created March 24, 2019 17:52
Show Gist options
  • Save pracps/db6fb74a123d024498865d1043968045 to your computer and use it in GitHub Desktop.
Save pracps/db6fb74a123d024498865d1043968045 to your computer and use it in GitHub Desktop.
Location specific time parsing
loc, _ := time.LoadLocation("Asia/Kolkata")
format := "Jan _2 2006 3:04:05 PM"
fp1_time_string := "Mar 15 2019 06:30:00 AM"
fp2_time_string := "Mar 15 2019 10:30:00 AM"
fp1_time, _ := time.ParseInLocation(format, fp1_time_string, loc)
fp2_time, _ := time.ParseInLocation(format, fp2_time_string, loc)
log.Println(fp1_time)
log.Println(fp2_time)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment