Results 1 to 3 of 3
  1. #1
    Join Date
    Nov 2003
    Location
    Dhaka,Bangladesh
    Posts
    86

    Unanswered: SQL Server gettime() question

    Hello Experts,

    When i issue "Select gettime()" it shows me "[date] [time]" from system date.I need to parse differently date and time from function gettime().Looking for help....
    hello

  2. #2
    Join Date
    Jun 2003
    Posts
    269

    Thumbs up Re

    Are u talking about getdate() function?
    then check datepart() function in SQl Server books online
    I love cursor,though I never use it.Cos' I dont want to misuse it.
    ----------------------------------------------

    ----cheers
    ----http://mallier.blogspot.com

  3. #3
    Join Date
    Jun 2003
    Location
    Ohio
    Posts
    12,592
    Provided Answers: 1
    There is no gettime() function.
    GetDate() returns the current date and time in datetime datatype. The datetime datatype ALWAYS includes a date portion, even if this portion is zero (indicating 1/1/1900). You can strip the current date off of any datetime value converting it to the same time on 1/1/1900 using this formula:
    Code:
    select dateadd(day, -datediff(day, 0, getdate()), getdate())
    Once all your time values are converted thus, you can compare them as if they had no date portion.
    If it's not practically useful, then it's practically useless.

    blindman
    www.chess.com: "sqlblindman"
    www.LobsterShot.blogspot.com

Posting Permissions

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