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


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

language settings for date functions

From A Retey <awnl@gmx-topmail.de>
Newsgroups comp.soft-sys.math.mathematica
Subject language settings for date functions
Date 2011-10-25 10:26 +0000
Organization Steven M. Christensen and Associates, Inc and MathTensor, Inc.
Message-ID <j862tf$5vc$1@smc.vnet.net> (permalink)

Show all headers | View raw


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

Back to comp.soft-sys.math.mathematica | Previous | Next | Find similar | Unroll thread


Thread

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

csiph-web