Results 1 to 2 of 2
  1. #1
    Join Date
    Aug 2008
    Posts
    24

    Unanswered: hour from unixtime

    dear all,

    i would like to ask about extracting hour form system/unix time, using hour() or similar function.

    thanks.

  2. #2
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    if you want the current hour,
    Code:
    SELECT HOUR(CURRENT_TIMESTAMP) as current_hour
      FROM ...
    if you have a column value that's a unix time,
    Code:
    SELECT HOUR(FROM_UNIXTIME(daColumn)) as current_hour
      FROM ...
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •