#1
  1. Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Nov 2003
    Posts
    758
    Rep Power
    124

    Update time only of a datetime field


    I am trying to update the time portion only of a datetime field. I tried
    update `table` set time(field) = '08:30:00'
    and it doesn't like it. How do I update the time portion?

    I also tried
    start = CONCAT(DATE(start), ' 08:33:00')
    and that didn't work either.

    Thanks,
    Last edited by epanagio; October 25th, 2010 at 12:55 PM.
  2. #2
  3. SQL Consultant
    Devshed Supreme Being (6500+ posts)

    Join Date
    Feb 2003
    Location
    Toronto Canada
    Posts
    27,794
    Rep Power
    4331
    SET field = DATE(field) + INTERVAL 512 MINUTE
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL
  4. #3
  5. Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Nov 2003
    Posts
    758
    Rep Power
    124
    Thanks, In addition to using the wrong functions I had mistakenly erased (NULL) the data and that made the effort difficult.
    Thanks!

IMN logo majestic logo threadwatch logo seochat tools logo