Datetime format

Emmie Wawa wrote: <snip>

But i only want the format to be 2008-06-05 08:45:58 because only these match the mysql datetime format. Is there other way of do the parsing? Thanks

Wawa

<snip>

You can output the datetime in any format you desire using the strftime method. Off the top of my head, something like this may do the trick:

date.strftime('%Y-%m-%d %H:%M:%S)

for usage in db you can do:

date.to_s(:db)

this will output any DateTime for use with SQL