Path: csiph.com!usenet.pasdenom.info!aioe.org!newsfeed1.swip.net!uio.no!newspump.sol.net!posts.news.twtelecom.net!nnrp3.twtelecom.net!not-for-mail From: Alexei Boulbitch Newsgroups: comp.soft-sys.math.mathematica Subject: Re: hold question Date: Wed, 12 Feb 2014 10:05:27 +0000 (UTC) Sender: steve@smc.vnet.net Approved: Steven M. Christensen , Moderator Message-ID: Lines: 58 Organization: Time-Warner Telecom NNTP-Posting-Date: 12 Feb 2014 10:10:54 GMT NNTP-Posting-Host: d5559eed.news.twtelecom.net X-Trace: DXC=kYD9dQ_Gb8XQZDch=kU29[C_A=>8kQj6];[h;PUXBgbTR?JXX0Glei^EFiONJ7[GoV[]9CU X-Complaints-To: abuse@twtelecom.net Xref: csiph.com comp.soft-sys.math.mathematica:16559 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) Hi, Francisco, No need to use Hold or alike. I created the Excel file with the name "dateExample.xls". It only contains the date, the one you wish: 1/8/2007. Then I imported it into the notebook that was in the same directory as the Excel file as follows: imp=Import[NotebookDirectory[]<>"dateExample.xls"] This the outcome: {{{{2007,1,8,0,0,0.}}}} Then this: DateString[ imp[[1, 1, 1]], {"", "", "Month", "/", "Day", "/", "YearShort"}] yields the desired output: "01/08/07" It appears as a string and, therefore, is not considered by Mathematica as an arithmetic operation. Have fun, Alexei Alexei BOULBITCH, Dr., habil. IEE S.A. ZAE Weiergewan, 11, rue Edmond Reuter, L-5326 Contern, LUXEMBOURG Office phone : +352-2454-2566 Office fax: +352-2454-3566 mobile phone: +49 151 52 40 66 44 e-mail: alexei.boulbitch@iee.lu