Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

language settings for date functions

9 views
Skip to first unread message

A Retey

unread,
Oct 25, 2011, 6:26:55 AM10/25/11
to
hi,

actually this is a followup to another post about the date functions. I
think it has been dicussed several times that these are relatively slow,
so when working with large datasets it is often necessary to use more
specialiced ways to e.g. convert strings to numberic date formats.

While it is not exactly an error for these functions to be slow I just
found that there are some inconsistencies about language settings with
these functions. E.g. the example from the other post did not even work
for me, which seems to be due to the language of my Windows 7 being set
to German:

In[29]:= t = {"14-May-10 09:58:05", {"Day", "-", "MonthNameShort",
"-", "YearShort", " ", "Hour", ":", "Minute", ":", "Second"}};
AbsoluteTime[t]

During evaluation of In[29]:= AbsoluteTime::str: String 14-May-10
09:58:05 cannot be interpreted as a date in format
{Day,-,MonthNameShort,-,YearShort, ,Hour,:,Minute,:,Second}. >>

Out[30]= $Failed

Why do I think it is the language settings? Because this works:

t = {"14-Mai-10 09:58:05", {"Day", "-", "MonthNameShort", "-",
"YearShort", " ", "Hour", ":", "Minute", ":", "Second"}};
AbsoluteTime[t]

now I thought I probably could circumvent this by settings $Language to
"German", but to no avail. Since I suspect that the date conversion in
one way or another is done with calls to Java, I also tried to change
the java runtime properties user.language and user.country but that did
not change anything. An interesting detail is that no matter what these
settings are, DateString will always return "english" month names:

DateString[{2011, 5, 1}, {"MonthName"}]

In[37]:= DateString[{2011, 5, 1}, {"MonthName"}]

Out[37]= "May"

while the other way round Mathematica insists on german month names.
Does anyone know whether and how I could possibly change that? Would
anyone disagree in that this is a bug?


albert

0 new messages