[julia-users] Re: strptime confusion

2014-12-21 Thread Avik Sengupta
Yes, that should work, but i cannot replicate your issue in julia version 
0.3.4-pre... the strptime methods  seem to be defined on the abstract type 
String, which should accept a SubString. What version of Julia are you 
using? Can you see the result of "methods(strptime)" ? That is in general a 
good way to solve issues such as this. 

julia> a=SubString(utf8("2014-06-20"), 1,10)
"2014-06-20"

julia> typeof(a)
SubString{UTF8String} (constructor with 1 method)

julia> b="2014-06-20"
"2014-06-20"

julia> typeof(b)
ASCIIString (constructor with 2 methods)

julia> a==b
true

julia> strptime("%Y-%m-%d", a)
TmStruct(0,0,1,20,5,114,5,170,1,0,3600,0,-1765316840,32751)

julia> methods(strptime)
# 2 methods for generic function "strptime":
strptime(timestr::String) at libc.jl:48
strptime(fmt::String,timestr::String) at libc.jl:50


 
On Sunday, 21 December 2014 14:28:50 UTC, tobiasjone wrote:
>
> Hello,  
>
> I solved by encoding a to utf8,  and the TmStruct was returned as 
> expected.
>
> *julia>* strptime("%Y-%m-%d", utf8(a))
> TmStruct(0,0,0,20,5,114,5,170,0,0,0,0,0,0
>
> Many Thanks,
> Tobias
>


[julia-users] Re: strptime confusion

2014-12-21 Thread tobiasjone
Hello,  

I solved by encoding a to utf8,  and the TmStruct was returned as expected.

*julia>* strptime("%Y-%m-%d", utf8(a))
TmStruct(0,0,0,20,5,114,5,170,0,0,0,0,0,0

Many Thanks,
Tobias