Paul Lutus wrote:
> Comfort Eagle wrote:
> 
>> What is the best Date format for working with dates in ruby & mysql?
> 
> As to MySQL, you really need to stick to a strict date format of 
> yyyy-mm-dd.
> This is MySQL's date format when shown in plain text.
> 
>> I have a recurring task that once complete I want to update the db to
>> reflect the next time to do it.
>> 
>> "2006-11-30" as a string ends up being just "2006".
> 
> This didn't happen by magic, you created it with some code. If you show 
> us
> the code, we will show you the magic.


class Date
  def Date.now
    return Date.jd(DateTime.now.jd)
  end
end

url ='http://xxx.com'
begin
  date = Date.now.to_s
  p date
  dbh = Mysql.real_connect("localhost", "xxx", "xxxx", "xxxxx")
  chg = dbh.query("UPDATE sites set updated='#{date}' where 
url='#{url}'")

-- 
Posted via http://www.ruby-forum.com/.