MathGroup Archive 2011

[Date Index] [Thread Index] [Author Index]

Search the Archive

language settings for date functions

  • To: mathgroup at smc.vnet.net
  • Subject: [mg122336] language settings for date functions
  • From: A Retey <awnl at gmx-topmail.de>
  • Date: Tue, 25 Oct 2011 06:19:32 -0400 (EDT)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com

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



  • Prev by Date: Re: how do you prevent numerator expansion when using 'Together'?
  • Next by Date: Re: AbsoluteTime[] runs slowly?
  • Previous by thread: MatrixPower works inconsistently for a matrix of elements of GF[p]
  • Next by thread: still struggling about integration