How to parse a "dd/mm/yyyy" formatted date string?

On Jun 25, 2008, at 5:29 AM, Titan wrote:

Hello,

I have been facing the same problem as Greg, but unfortunately neither
of these worked for me :frowning:

dateStr = params[:startdate].to_s
logger.info "date - " + dateStr
startdate =Date.strptime(dateStr, ‘%m/%d/%Y’).to_s

Daniel’s tip to convert a string to a date should work for you:

startdate = dateStr.to_date
=> Fri, 16 May 2008

or

startdate = dateStr.to_time
=> Fri May 16 00:00:00 UTC 2008

Best.
Mike