Mathematica 9 is now available
Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2008

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

Search the Archive

Problem parsing date formats using Import

  • To: mathgroup at smc.vnet.net
  • Subject: [mg90458] Problem parsing date formats using Import
  • From: Jon <rowland.jon at gmail.com>
  • Date: Thu, 10 Jul 2008 06:33:43 -0400 (EDT)

Hi,

I'm trying to parse a file which has dates in the format YYYYMMDD,
e.g. 20080101. However I just can't seem to get the DateStringFormat
to work - it works fine for YYYY-MM-DD or YYYYMM-DD but not if I
remove the separators entirely. Is this because of the ambiguity
between numeric and this date format? Does the automatic date parsing
not work for entirely numeric date formats?

Thanks and regards,
Jon Rowland

In[137]:= ImportString["1982-04-22\n1982-04-23", "Table",
"DateStringFormat" -> {"Year", "-", "Month", "-", "Day"}]
Out[137]= {{{1982, 4, 22}}, {{1982, 4, 23}}}

In[138]:= ImportString["198204-22\n198204-23", "Table",
"DateStringFormat" -> {"Year", "Month", "-", "Day"}]
Out[138]= {{{1982, 4, 22}}, {{1982, 4, 23}}}

In[139]:= ImportString["19820422\n19820423", "Table",
"DateStringFormat" -> {"Year", "Month", "Day"}]
Out[139]= {{19820422}, {19820423}}


  • Prev by Date: RE: Solving a DE using Mathematica
  • Next by Date: Re: VectorFieldPlot scaling
  • Previous by thread: Re: Almost symbolic computations (?)
  • Next by thread: Re: Problem parsing date formats using Import