Created
June 12, 2013 18:25
-
-
Save k-k/5767808 to your computer and use it in GitHub Desktop.
Creates a linux command to quickly convert a date time string into an ObjectId string.
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
#!/usr/bin/env php | |
<?php | |
echo str_pad( dechex( strtotime( $argv[1] ) ), 8, "0", STR_PAD_LEFT ) . "0000000000000000\n"; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Taken from Kristina Chodrow's answer on Stackoverflow.
Allows me to quickly create timestamp based ObjectIds for querying on the console. Just make executable and copy to
/usr/bin/
.