Results 1 to 4 of 4

Thread: Get day name from date selection parameter

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Nov 2005
    Posts
    259

    Get day name from date selection parameter

    I have a date selection parameter where I need to get the day name to put on the report.

    My string looks like this: "Car Counts between the dates of " + ToText({?dtDateBegin}) + " and " + ToText({?dtEndDate})

    Which shows on the report like this: Car Counts between the dates of 10/1/2005 and 10/31/2005

    What I am trying to do is to get it to say: Car Counts between the dates of 10/1/2005 (Saturday) and 10/31/2005 (Monday).

    I thought something like this would work

    "Car Counts between the dates of " + ToText({?dtDateBegin}) + " " + WeekdayName({?dtDateBegin}) + " and " + ToText({?dtEndDate}) + " " + WeekdayName({?dtEndDate})

    but that wants a number at the ?dtDateBegin and end parameters. Any ideas? I just looked a little deeper into the WeekdayName and that is looking for a value of 1 -7. I want to get a day name when someone selects 10/1/05 from a date selector.

  2. #2
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901

    Re: Get day name from date selection parameter

    I've used this before to get the name of the day:

    VB Code:
    1. Option Explicit
    2.  
    3. Private Sub Form_Load()
    4.   MsgBox WeekdayName(Weekday(Now))
    5. End Sub

  3. #3
    PowerPoster
    Join Date
    Oct 2002
    Location
    British Columbia
    Posts
    9,758

    Re: Get day name from date selection parameter

    You are probably using Crystal Syntax so the equivalent would be

    + WeekdayName(DayOfWeek({?dtEndDate}))

  4. #4

    Thread Starter
    Hyperactive Member
    Join Date
    Nov 2005
    Posts
    259

    Re: Get day name from date selection parameter

    Thank you both. I am using Crystal Syntax so the second solution worked perfectly.

Posting Permissions

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



Click Here to Expand Forum to Full Width