This is a migrated thread and some comments may be shown as answers.

DateTime operations and formating

1 Answer 791 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Steve
Top achievements
Rank 2
Steve asked on 24 Sep 2013, 12:07 PM
I am currently testing out Telerik Reporting. I have a trial version of Visual Studio to test the integrated designer but I would like to do without it using with standalone report designer. I have managed to do the operations I wanted after learning I had to cast my report parameter and the AddDays parameter :

= CDate(Parameters.date.Value).AddDays(CDbl(6))

My next requirement was to convert a DateTime into a 1 letter day of week. Simple formatting would not allow me to do this. The further I could go was an abbreviation of the day of the week (thu. for example). What I needed was "T", "M", etc.

AddDays looked very familiar... so I tried adding .DayOfWeek. Result:

= Substr(CStr(CDate(Parameters.date.Value).AddDays(CDbl(6)).DayOfWeek), 0, 1)

This worked, almost. The result is indeed what I expected, with the exception that it does not globalize to French like a simple format would.

How can I get the 1st letter of the DayOfWeek in French without using Visual Studio integrated designer?

1 Answer, 1 is accepted

Sort by
0
Steve
Top achievements
Rank 2
answered on 24 Sep 2013, 12:16 PM
Found a solution to my own question.

Using ToString with the format string instead of using the textbox's format attribute, I was able to do operations on the formated date instead of using the DayOfWeek's enum name.

= ToUpper(Substr(CDate(Parameters.date.Value).ToString("ddd"), 0, 1))


Tags
General Discussions
Asked by
Steve
Top achievements
Rank 2
Answers by
Steve
Top achievements
Rank 2
Share this question
or