Last active
August 29, 2015 14:08
-
-
Save OnorioCatenacci/3490f89b107c6700935f to your computer and use it in GitHub Desktop.
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
#Two small, quick date utility functions. Convert a wxDateTime (from wxErlang) to a YYYYMMDD string. NB: assumes year is post 1000 CE. | |
defp wxDatetime_to_string({{year,month,day},{_hour,_minute,_second}}), do: "#{year}#{zero_padding(month,2)}#{zero_padding(day,2)}" | |
#Pad a string out with a specified number of leading zeroes. | |
defp zero_padding(string,len), do: String.rjust(to_string(string), len, ?0) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment