Results 1 to 4 of 4

Thread: time in sql

  1. #1
    Join Date
    Jan 2004
    Location
    South Africa
    Posts
    178

    Question Unanswered: time in sql

    how do I select the hour from a date/time value in SQL?

    thanks in advance
    Actionant

  2. #2
    Join Date
    Oct 2003
    Location
    Ger
    Posts
    1,969
    Provided Answers: 1

    Re: time in sql

    Originally posted by actionant
    how do I select the hour from a date/time value in SQL?

    thanks in advance
    Actionant
    Use
    Mid(Now,10,2)

  3. #3
    Join Date
    Oct 2003
    Location
    Ger
    Posts
    1,969
    Provided Answers: 1
    I mean
    Mid([yourField],10,2)

  4. #4
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    rather than hoping for conversion to the correct string format which happens to contain the hour in a specific byte position, how about using the function that was intended for the purpose?

    hour(datetimecol)
    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
  •