PDA

Click to See Complete Forum and Search --> : Get day name from date selection parameter


FastEddie
Dec 14th, 2005, 12:19 PM
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.

dglienna
Dec 14th, 2005, 12:24 PM
I've used this before to get the name of the day:

Option Explicit

Private Sub Form_Load()
MsgBox WeekdayName(Weekday(Now))
End Sub

brucevde
Dec 14th, 2005, 12:42 PM
You are probably using Crystal Syntax so the equivalent would be

+ WeekdayName(DayOfWeek({?dtEndDate}))

FastEddie
Dec 14th, 2005, 01:25 PM
Thank you both. I am using Crystal Syntax so the second solution worked perfectly.