Re: date format
- To: mathgroup at smc.vnet.net
- Subject: [mg75130] Re: date format
- From: Norbert Marxer <marxer at mec.li>
- Date: Wed, 18 Apr 2007 04:59:18 -0400 (EDT)
- References: <f015bp$9sk$1@smc.vnet.net>
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