How to Change Date Format in .net RDLC Report?
Asked Answered
U

11

20

I need to set my date column as 01-Jan-2013, what is the format to acheieve this in rdlc?

I have given

=CDate(Fields!IssuingDate.Value).ToString("dd-mmm-yyyy")

its not working correctly. Any one post me the format for 02-Jul-2013.

Ulent answered 23/7, 2013 at 5:54 Comment(0)
K
29

Use this you will get your output

=CDate(Fields!IssuingDate.Value).ToString("dd-MMM-yyyy")
Knossos answered 22/8, 2014 at 6:26 Comment(0)
P
22

Possibility 1:

I think the correct format string is "dd-MMM-yyyy" (uppercase M, see MSDN)

And I would use Format(Fields!IssuingDate.Value,"dd-MMM-yyyy")instead of ToString()

Possibility 2:

Just use Fields!IssuingDate.Value as Expression of your TextBox and set the Format property of the TextBox to dd-MMM-yyyy

Perusal answered 23/7, 2013 at 6:15 Comment(0)
K
11

Date formats can also be changed by right clicking the field in the RDLC report (whose format we want to change) and:

  1. choose "Text box properties"
  2. then choose the option "Number"
  3. then choose one of the multiple "Date" options, or specify a Custom formatting option

enter image description here

Kristopher answered 21/12, 2013 at 6:47 Comment(0)
A
4

In the Expression property, set the following format and it will work fine:

=Format(Cdate(Fields!InvoiceDate.Value),"yyyy/MM/dd")
Achromatic answered 19/2, 2018 at 6:16 Comment(0)
E
1

Do not use any formatting function like Format(). Instead right click on the text box and select Text Box Properties... And then select Number from left column and set your desire format like in Excel.

You can many other properties like Alignment, Fill and Action.

Emmenagogue answered 22/5, 2018 at 8:58 Comment(1)
In my case, I need to round to 2 decimals and it was rounding 175.89 to 175.9. I removed Round() and apply the format like mentioned above and get the desired result 175.90Emmenagogue
I
1

Check the datatype in XSD is System.DateTimeOffset, I couldn't get any formatting working without changing the type to System.DateTime .

enter image description here Covert datetimeoffset to datetime from the select query:

SELECT 
A,
B,
CONVERT(datetime2, MyTable.DateTimeOffsetField, 1) AS DateTimeField
FROM MyTable

After changing the type to DateTime all the formatting started working

Eg: =Format(Fields!DateTimeField.Vaule, "dd-mmm-yyyy")

Ivett answered 11/11, 2019 at 0:21 Comment(0)
L
1

This may be helpful

= CDate(Fields!Date.Value).ToString("dd-MMM.-yyyy" )
Lewislewisite answered 3/6, 2020 at 22:41 Comment(0)
P
0
CDate(Fields!IssuingDate.Value).ToString("dd-mmm-yyyy")

Change it as follows it will work definitely:

ToString should be toString and mmm should be MMM, so you'll have:

CDate(Fields!IssuingDate.Value).toString("dd-MMM-yyyy")
Pym answered 20/10, 2016 at 4:31 Comment(0)
E
0

This works, too (and doesn't fail when DateValue.Value is null):

=String.Format("{0:dd-MMM-yyyy}", Fields!DateValue.Value)
Earpiece answered 8/2, 2018 at 20:7 Comment(0)
A
0

You can edit your rdlc as XML and just use Now(), the same as DateTime.Now, and Format.

<Value>="Date: " &amp; Format(Now(), "dd/MM/yyyy HH:mm")</Value>

Result in file "Date: 22/08/2019 10:20"

Aquila answered 22/8, 2019 at 13:20 Comment(0)
B
0

RDLC 2022 =CDate(Fields!DateField.Value).toShortDateString();

Biquarterly answered 7/7, 2023 at 7:52 Comment(1)
Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.Unaccomplished

© 2022 - 2025 — McMap. All rights reserved.