Isthere any function in T-SQL to get day of week using?

  • I've found that there is a function called "trftime" in Sqlite. However, I cannot find any function like this in T-SQL. Is there any function to do this?

     

  • Like this? I don't know SQLLite.

    select datepart(dw, getdate())

    The absence of evidence is not evidence of absence.
    Martin Rees

    You can lead a horse to water, but a pencil must be lead.
    Stan Laurel

  • Unless you're looking for..

    datename(dw, getdate())..?!?!

    Since the datepart is dependent on the current setting of "datefirst"...check that first if that's the one you want..







    **ASCII stupid question, get a stupid ANSI !!!**

  • If you only want to get the day index, you should check the following description:

    MS SQL: Day of Week

  • perhaps use convert e.g. convert(varchar, xdate,101)

  • don't know sqlite... it would be helpful if you describe what the function does and give an example.

  • Were you able to find an equivalent function in SQL?

  • kpao (4/1/2006)


    I've found that there is a function called "trftime" in Sqlite. However, I cannot find any function like this in T-SQL. Is there any function to do this?

    You really do need to tell us what that does. Are you looking for a numeric day of the week, a 3 letter name of the day of the week, or the full name of the day of the week?

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

  • ulfemsoy (10/12/2011)


    If you only want to get the day index, you should check the following description:

    MS SQL: Day of Week

    You don't need a UDF for this...

    SELECT (DATEDIFF(dd,'17530101',GETDATE())-1) %7

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

  • BWAA-HAAA!!! I just realized the original question is from 5 years ago and the OP is probably long gone. 😀

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

Viewing 10 posts - 1 through 9 (of 9 total)

You must be logged in to reply to this topic. Login to reply