Skip to content

Instantly share code, notes, and snippets.

@amitu
Last active August 29, 2015 14:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save amitu/1003c10ead57785b49fd to your computer and use it in GitHub Desktop.
Save amitu/1003c10ead57785b49fd to your computer and use it in GitHub Desktop.
LDAP timestamp to Unix Epoch
package main
import (
"fmt"
"os"
"time"
)
func main() {
if len(os.Args) != 2 {
fmt.Println("Usage: ldap2unix <date>")
os.Exit(2)
}
t, err := time.Parse("20060102150405Z", os.Args[1])
if err != nil {
fmt.Println(err)
os.Exit(1)
}
fmt.Println(t.Unix())
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment