Skip to Content
avatar image
Former Member

Day of Week Function

Is there a function in Crystal that tells you the day of the week that a date is???

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

2 Answers

  • Best Answer
    avatar image
    Former Member
    Sep 21, 2010 at 01:26 PM

    Yes

    Dayofweek(date)   //will give you the number of the day of the week with 1 being Sunday
    Weekdayname(Dayofweek(date))   //will give you the name of the day

    for other date/time functions, look under functions for date and time in the formula workshop

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Sep 21, 2010 at 01:44 PM

    Yes there is... One of which is actually called DayOfWeek. You can also use the DatePart function as well. Both will return an integer value ranging from 1 - 7.

    DayOfWeek({TableName.DateField})
    -or-
    DatePart("w", {TableName.DateField})
    

    If you want to get the actual name of the week you can use a formula like this...

    SELECT DayOfWeek(CurrentDate)
    CASE 1 : "Sunday"
    CASE 2 : "Monday"
    CASE 3 : "Tuesday"
    CASE 4 : "Wednesday"
    CASE 5 : "Thursday"
    CASE 6 : "Friday"
    CASE 7 : "Saturday"
    ;
    

    HTH,

    Jason

    -


    Interesting Deb... I've never used WeekDayName.

    Edited by: Jason Long on Sep 21, 2010 8:45 AM

    Add comment
    10|10000 characters needed characters exceeded