 
 
 
 
 
 
Re: Date & Time format..
- To: mathgroup at smc.vnet.net
- Subject: [mg107581] Re: Date & Time format..
- From: Bill Rowe <readnews at sbcglobal.net>
- Date: Thu, 18 Feb 2010 05:16:10 -0500 (EST)
On 2/17/10 at 7:01 AM, graser at gmail.com (graser) wrote:
>I have a list of date and time string such as..
>AA = {"Start", "Time", "11/4/2009", "3:24:06.505", "PM"}
>I want to read "11/4/2009", "3:24:06.505", "PM" as date format..
>so I did
>DateList["11/4/2009 3:24:06.505 PM"] and actually it gives me as
>{2009, 11, 4, 15, 24, 6.505}
>But there is also waring message like..
>** DateList::ambig: Warning: the interpretation of the string
>11/4/2009 3:24:06.505 PM as a date is ambiguous. >> ***
>So I thought the problem was "PM"
That is not the issue. The uncertainty is whether the "11/4"
portion of the string is a month followed by a day or a day
followed by a month.
>I tried it again with
>DateList[{"11/4/2009 3:24:06.505 PM", {"Day", "Month", "Year",
>"Hour", "Minute", "Second", "AMPM"}}]
>But it didn't work...
This doesn't work because what you told Mathematica to expect
doesn't match the format of the string. This works
In[9]:= DateList[{"11/4/2009 3:24:06.505 PM", {"Day", "Month", "Year",
     "Hour", "Minute", "Second", "Millisecond", "AMPM"}}]
Out[9]= {2009,4,11,3,24,6.505}
and this works
In[10]:= DateList[{"11/4/2009 3:24:06 PM", {"Day", "Month", "Year",
    "Hour", "Minute", "Second", "AMPM"}}]
Out[10]= {2009,4,11,3,24,6}

