Created
August 29, 2013 06:00
-
-
Save levicole/6374665 to your computer and use it in GitHub Desktop.
http://tantek.pbworks.com/w/page/19402946/NewBase60 Got the idea from here.
This file contains hidden or 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 ( | |
"time" | |
"strconv" | |
"fmt" | |
) | |
var NewBase60Vocab [60]string | |
func init() { | |
NewBase60Vocab = [60]string{ "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "A", "B", "C", "D", "E", "F", "G", "H", "J", "K", "L", "M", "N", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "_", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z" } | |
} | |
func main() { | |
now := time.Now() | |
count := strconv.Itoa(11) | |
dayOfYear := strconv.Itoa(now.YearDay()) | |
year := strconv.Itoa(now.Year()) | |
dateCount, _ := strconv.Atoi(year + dayOfYear + count) | |
sgx := "" | |
for dateCount > 0 { | |
mod := dateCount % 60 | |
sgx = sgx + NewBase60Vocab[mod] | |
dateCount = (dateCount - mod)/60 | |
} | |
fmt.Println(sgx) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment