Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #5868 > unrolled thread

language settings for date functions

Started byA Retey <awnl@gmx-topmail.de>
First post2011-10-25 10:26 +0000
Last post2011-10-25 10:26 +0000
Articles 1 — 1 participant

Back to article view | Back to comp.soft-sys.math.mathematica


Contents

  language settings for date functions A Retey <awnl@gmx-topmail.de> - 2011-10-25 10:26 +0000

#5868 — language settings for date functions

FromA Retey <awnl@gmx-topmail.de>
Date2011-10-25 10:26 +0000
Subjectlanguage settings for date functions
Message-ID<j862tf$5vc$1@smc.vnet.net>
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

[toc] | [standalone]


Back to top | Article view | comp.soft-sys.math.mathematica


csiph-web