How do you search a datetime field order by months?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • dhanu sahu
    New Member
    • Mar 2008
    • 14

    How do you search a datetime field order by months?

    Hi all


    I have a SQL database table with a datetime field in dd/mm/yyyy
    format.

    I have a web page that allows users to search this database.
    How do you search a datetime field order by months ?
  • Plater
    Recognized Expert Expert
    • Apr 2007
    • 7872

    #2
    Do you want to do it in SQL or in code?
    The principal is the same, extract the month and search on that.

    For instance, in code, a DateTime object could be checked against its .Month property.
    And in SQL you could use the datepart() (or maybe it's just Convert() ?)

    Comment

    Working...