SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Zealot
    Join Date
    Aug 2009
    Posts
    159
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Remove Time from DateTime Field

    Hi

    Im trying to remove the "time" from a datetime field in a Table on SQL sever 2000

    Im using this from today
    (convert(datetime,floor(convert(float(24),getdate()))))

    which is working for any records added to the Database from today

    anyone got any tips for removing the time from records already in the Database, keeping the original Date?

    Thanks

  2. #2
    SQL Consultant gold trophysilver trophybronze trophy
    r937's Avatar
    Join Date
    Jul 2002
    Location
    Toronto, Canada
    Posts
    39,263
    Mentioned
    60 Post(s)
    Tagged
    3 Thread(s)
    Code:
    UPDATE daTable
       SET datetimecolumn = CONVERT(DATETIME,FLOOR(CONVERT(FLOAT(24),datetimecolumn)))
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL
    "giving out my real stuffs"

  3. #3
    SitePoint Zealot
    Join Date
    Aug 2009
    Posts
    159
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Perfect just what I was looking for

    Thanks R937


Bookmarks

Posting Permissions

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