DateTime.parse works for me when using the format "2005-Oct-12". I
tried with yours, and it doesn't like the slashes, but it was smart
enough to figure out the order of the date:
require 'date'
d = DateTime.parse("28-Sep-2005")
d.to_s => "2005-09-28T00:00:00Z"
So, I would just do a gsub before calling parse. i.e. d =
DateTime.parse("28/Sep/2005".gsub!("/", "-"))
HTH
On 31-Oct-05, at 8:23 AM, Hardy Henneberg wrote:
> Hi,
> I have a string of format: '28/Sep/2005'.
> I am looking for the easiest way to create a Date from that string.
> I don't want to make my own conversion of monthname to monthnumber
> if not needed.
>
> regards
> Hardy
>
>
|