From: graser on
Hi

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"

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...

Do you have any idea how to handle AMPM part?

Thanks


From: David Park on
The ambiguity is whether "11/4/2009" is the 11th day of the 4th month or the
4th day of the 11th month since this is used both ways. So if it is the way
you want don't worry. You can use Quiet to suppress the messages. Otherwise
you can give a more specific date string specification.


David Park
djmpark(a)comcast.net
http://home.comcast.net/~djmpark/



From: graser [mailto:graser(a)gmail.com]


Hi

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"

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...

Do you have any idea how to handle AMPM part?

Thanks




From: Bill Rowe on
On 2/17/10 at 7:01 AM, graser(a)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}


From: Michael Stern on
The ambiguity is with the date format, not the time. Is "11/4/2009"
intended to mean November 4, or April 11?

Michael



graser wrote:
> Hi
>
> 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"
>
> 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...
>
> Do you have any idea how to handle AMPM part?
>
> Thanks
>
>
>

From: Alexey Popkov on
Hello,
The following should work but does not:

DateList[{"11/4/2009 3:24:06.303 PM", {"Day", "Month", "Year", "Hour12",
"Minute", "SecondExact", "AMPM"}}]

It looks like a bug.



"graser" <graser(a)gmail.com> news:hlglh3$l4v$1(a)smc.vnet.net...
> Hi
>
> 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"
>
> 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...
>
> Do you have any idea how to handle AMPM part?
>
> Thanks
>
>



 |  Next  |  Last
Pages: 1 2
Prev: Question about Plot[] algorythm.
Next: DDFLink