Last active
August 29, 2015 14:16
-
-
Save amitu/1003c10ead57785b49fd to your computer and use it in GitHub Desktop.
LDAP timestamp to Unix Epoch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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