Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2007
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2007

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

Search the Archive

Re: date format

  • To: mathgroup at smc.vnet.net
  • Subject: [mg75127] Re: date format
  • From: Jean-Marc Gulliet <jeanmarc.gulliet at gmail.com>
  • Date: Wed, 18 Apr 2007 04:57:46 -0400 (EDT)
  • Organization: The Open University, Milton Keynes, UK
  • References: <f015bp$9sk$1@smc.vnet.net>

Arkadiusz.Majka at gmail.com wrote:
> Dear All,
> 
> Form the following date format
> 
> 04/Dec/2006:19:54:02
> 
> could you please show me how to get the following representation {day,
> month, year, hour, minutes, seconds} - so exactly the same as for
> Date[]
> 
> Thank you,
> 
> Arek
> 
> 

You could try the following:

In[1]:=
rules = {"Jan" -> 1, "Dec" -> 12};
date = "04/Dec/2006:19:54:02";
ToExpression[StringSplit[date, Characters["/:"]] /.
     rules][[{3, 2, 1, 4, 5, 6}]]

Out[3]=
{2006, 12, 4, 19, 54, 2}

which is in the same format as the expression returned by Date[] on my 
system.

In[4]:=
Date[]

Out[4]=
{2007, 4, 17, 15, 16, 29.0625`9.215907880295621}

Regards,
Jean-Marc


  • Prev by Date: Re: neat way to program minimum of sum
  • Next by Date: Re: Re: ImplicitPlot errors
  • Previous by thread: Re: date format
  • Next by thread: Re: date format