MathGroup Archive 2014

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

Search the Archive

Re: hold question


Dates in an imported spreadsheet import as a DateList.


Importing first sheet:


data = Import[
  "/Users/hanlonr/Desktop/Workbook1.xlsx",
  {"Data", 1}]


{{"Date", "Col 2", "Col 3"}, {{2014, 2, 1, 0, 0, 0.}, "a",
  12.}, {{2014, 2, 2, 0, 0, 0.}, "b", 35.}, {{2014, 2, 3, 0, 0, 0.}, "c",
  26.}, {{2014, 2, 4, 0, 0, 0.}, "a", 17.}, {{2014, 2, 5, 0, 0, 0.}, "b",
  19.}}


Convert DateList to DateString:


data /. d : {__?NumberQ} ->
   DateString[d,
    {"Month", "/", "Day", "/", "Year"}] //
 Quiet


{{"Date", "Col 2", "Col 3"}, {"02/01/2014", "a", 12.}, {"02/02/2014", "b",
  35.}, {"02/03/2014", "c", 26.}, {"02/04/2014", "a", 17.}, {"02/05/2014",
  "b", 19.}}



Bob Hanlon




On Mon, Feb 10, 2014 at 3:01 AM, Francisco Gutierrez <fgutiers2002 at yahoo.com
> wrote:

> Dear Group:
>
> Manipulating and importing/exporting dates is always a pain in the neck,
> in any of the languages I am aware of.
> Mathematica has functions to work around many of these issues, and I was
> actually able to complete the task
> I was involved in, but even then there is an issue I obviously do not
> understand.
>
> Say I have this date in an Excel sheet: 01/08/2007. I import in into
> Mathematica.  I want to prevent it from becoming an arithmetical
> expression, so
> I sorround it by Unevaluated, HoldAll, and other hold-like devices, but I
> do not obtain the desired result. The date becomes a division.
> For example, the output of HoldComplete[2+2] is  HoldComplete[2+2] , but
> instead the output of HoldComplete[ 01/08/2007]
> is HoldComplete[1/(8x 2007)].
>
> What I am overlooking?
> (Mathematica 9.0)
>




  • Prev by Date: Re: RowBox disappearing Lines
  • Next by Date: Re: hold question
  • Previous by thread: hold question
  • Next by thread: Re: hold question