MathGroup Archive 2007

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

Search the Archive

Re: Why Doesn't Mathematica Recognize System Dates?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg73717] Re: Why Doesn't Mathematica Recognize System Dates?
  • From: Peter Pein <petsie at dordos.net>
  • Date: Mon, 26 Feb 2007 06:13:46 -0500 (EST)
  • References: <eropqe$9dj$1@smc.vnet.net>

Gregory Lypny schrieb:
> Hello everyone,
> 
> I've imported some tab-delimited data with dates in the format day/ 
> month/year in one of the columns.  This is also the format I've  
> specified for the short format in OS X.
> 
> When I import the data, Mathematica reverses the month and day when  
> the day of the month is less than 13, so 5/2/2007 becomes {2007, 5,  
> 2}.  If the day of the month is 13 or higher, Mathematica can't  
> handle it and leaves it, so 15/2/2007 stays as 15/2/2007.
> 
> Is there any preference setting in Mathematica that I can change to  
> fix this?
> 
> Regards,
> 
> 	Greg
> 

Hi Greg,

I guess you want "DateStyle"->"European":

In[1]:= !!"C:\\date.txt"
>From In[1]:=
5/2/2007
15/2/2007

this is the behaviour, you described above:

In[2]:= Import["C:\\date.txt", "CSV"]
Out[2]= {{{2007,5,2}},{15/2/2007}}

and this is what you want (?):
In[3]:= Import["C:\\date.txt", "CSV",
  ConversionOptions -> {"DateStyle" -> "European"}]
Out[3]= {{{2007,2,5}},{{2007,2,15}}}


hth,
Peter


  • Prev by Date: Re: Tr[list] vs Plus@@list
  • Next by Date: Hold and Equal
  • Previous by thread: Why Doesn't Mathematica Recognize System Dates?
  • Next by thread: Kernel Crashing with NDSOlve