Re: [julia-users] Re: Convert datetime string that has AM/PM to datetime, without using Calendar.jl

2015-09-09 Thread Pontus Stenetorp
On 9 September 2015 at 01:05, Ian Butterworth wrote: > > I managed to make it work by removing the last 3 characters from the input > string, and using single format characters. > Also caught a bug that occurs when the hour in the string = 12, and it's PM. > I believe that hour was incorrectly bei

Re: [julia-users] Re: Convert datetime string that has AM/PM to datetime, without using Calendar.jl

2015-09-08 Thread Ian Butterworth
Ok. I'm running 0.4.0-dev on juliabox I managed to make it work by removing the last 3 characters from the input string, and using single format characters. Also caught a bug that occurs when the hour in the string = 12, and it's PM. I believe that hour was incorrectly being shifted.. but then

Re: [julia-users] Re: Convert datetime string that has AM/PM to datetime, without using Calendar.jl

2015-09-08 Thread Jacob Quinn
I'm not seeing the error on the latest master _ _ _ _(_)_ | A fresh approach to technical computing (_) | (_) (_)| Documentation: http://docs.julialang.org _ _ _| |_ __ _ | Type "?help" for help. | | | | | | |/ _` | | | | |_| | | | (_| | | Ve

Re: [julia-users] Re: Convert datetime string that has AM/PM to datetime, without using Calendar.jl

2015-09-08 Thread Ian Butterworth
Thanks for the tip, although I'm getting an error with your code in 0.4.0-dev Any idea why? using Base.Dates ds = "2015-08-12 12:01:23 PM" DateTime(ds, DateFormat("-mm-dd HH:MM:SS")) - (contains(ds, "AM") ? Hour (12) : Hour(0)) LoadError: ArgumentError: Non-digit character encountered w

Re: [julia-users] Re: Convert datetime string that has AM/PM to datetime, without using Calendar.jl

2015-09-08 Thread Pontus Stenetorp
On 8 September 2015 at 22:31, Ian Butterworth wrote: > > On Tuesday, 8 September 2015 17:27:25 UTC-4, Ian Butterworth wrote: >> >> I current use Calendar.jl to convert a datetime that contains AM/PM to the >> datetime type like this: >> datetime_string = "2015-08-12 12:01:23 PM" >> timeout = unix2

[julia-users] Re: Convert datetime string that has AM/PM to datetime, without using Calendar.jl

2015-09-08 Thread Ian Butterworth
Sorry, error in example. Should read: datetime_string = "2015-08-12 12:01:23 PM" timeout = unix2datetime(Calendar.parse("-MM-dd hh:mm:ss aa", datetime_string).millis/1000) On Tuesday, 8 September 2015 17:27:25 UTC-4, Ian Butterworth wrote: > > I current use Calendar.jl to convert a datetim