MathGroup Archive 2007

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

Search the Archive

Re: date format


On 17 Apr., 02:45, Arkadiusz.Ma... 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

Hello

You can use

str = StringReplace["04/Dec/2007:19:23:12", {StringExpression[day__,
"/", month__, "/", year__, ":", hour__, ":", min__, ":", sec__] :>
{day, month, year, hour, min, sec}}]
expr = ToExpression[str[[1]]]

If you also want to replace Jan by 1, ..., Dec by 12 you can add

expr /. {Jan -> 1, Dec -> 12}

Best Regards
Norbert Marxer



  • Prev by Date: Eliminate white border around DensityPlot?
  • Next by Date: Re: neat way to program minimum of sum
  • Previous by thread: Re: date format
  • Next by thread: Re: date format