Skip to content

Instantly share code, notes, and snippets.

@mwjcomputing
Created September 26, 2019 16:39
Show Gist options
  • Save mwjcomputing/d318c88e1a48e554af32d6a00443550c to your computer and use it in GitHub Desktop.
Save mwjcomputing/d318c88e1a48e554af32d6a00443550c to your computer and use it in GitHub Desktop.
A simple Go script to calculate days until Converge 2020.
// ==================================================
// = FileName: daysTillConverge2020.go
// = Author: Matt Johnson (@mwjcomputing)
// = Description: Calculates days until Converge 2020
// ==================================================
package main
import (
"fmt"
"time"
)
func main() {
// Set time location to Eastern as Converge is held in Detroit.
est, _ := time.LoadLocation("EST")
// Set date to the start of Converge, 5/14/2020 at 8am.
ConvergeDate := time.Date(2020, time.May, 14, 8, 0, 0, 0, est)
// Get current time and date.
Today := time.Now()
// Calculate number of hours between the two dates and divide by 24 to output days.
DaysBetween := int(ConvergeDate.Sub(Today).Hours() / 24)
// Display Results
fmt.Printf("There are %v days until Converge 2020. \n", DaysBetween)
fmt.Println("Don't forget to grab your ticket today at https://convergeconference.org.")
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment