Welcome to SPN

Register and Join the most happening forum of Sikh community & intellectuals from around the world.

Sign Up Now!

Re: How can I display the DAY of the week?

Discussion in 'Information Technology' started by blagory, Jul 28, 2006.

Tags:
  1. blagory

    blagory
    Expand Collapse
    Guest

    If you wish to display the day of the week as part of your result use
    DATENAME (I wanted the day of the week so I used the following. weekday
    is a sql key word and 'added_date' is my column name):
    datename(weekday, added_date)as day_of_week

    DATENAME
    Returns a character string representing the specified datepart of the
    specified date.

    Syntax
    DATENAME ( datepart , date )
    Arguments
    datepart

    Datepart Abbreviations
    year yy, yyyy
    quarter qq, q
    month mm, m
    dayofyear dy, y
    day dd, d
    week wk, ww
    weekday dw
    hour hh
    minute mi, n
    second ss, s
    millisecond ms


    The weekday (dw) datepart returns the day of the week (Sunday, Monday,
    and so on).


    If you specify only the last two digits of the year, values less than
    or equal to the last two digits of the value of the two digit year
    cutoff configuration option are in the same century as the cutoff year.
    Values greater than the last two digits of the value of this option are
    in the century that precedes the cutoff year. For example, if two digit
    year cutoff is 2049 (default), 49 is interpreted as 2049 and 2050 is
    interpreted as 1950. To avoid ambiguity, use four-digit years.

    Return Types
    nvarchar

    Remarks
    SQL Server automatically converts between character and datetime values
    as necessary, for example, when you compare a character value with a
    datetime value.

    Examples
    This example extracts the month name from the date returned by
    GETDATE.

    SELECT DATENAME(month, getdate()) AS 'Month Name'

    Here is the result set:

    Month Name
    ------------------------------
    February





    > I have searched and searched on the web, but can't seem to find the

    answer
    > to this. I can't imagine it would be too hard.
    >
    > How can I display the day of the week (for example: "Monday",

    "Tuesday",
    > "Wednesday") in my Date/Time field?
    >
    > Thanks !!
    >
    >
    [/B][/color]



    --
    blagory
    ------------------------------------------------------------------------
    Posted via http://www.mcse.ms
    ------------------------------------------------------------------------
    View this thread: http://www.mcse.ms/message551623.html
     
  2. Loading...

    Similar Threads Forum Date
    Heritage Sikh Artwork On Display At Texas University History of Sikhism Mar 6, 2015
    UK Sikh Turbans on display at Bradford exhibition Breaking News Mar 1, 2014
    History Rare photographs’ display: Sikh community and culture presented in vibrant colour Punjab, Punjabi, Punjabiyat Dec 8, 2013
    Events Manuscripts on display at National Museum of Pakistan. History of Sikhism Mar 3, 2013
    Turban Display Uncovers Sikh History Sikh Youth Jun 7, 2011

Share This Page