using the format function in report

Stimulsoft Reports.NET discussion
Post Reply
Stephan1
Posts: 122
Joined: Fri Aug 31, 2007 7:22 am
Location: Germany

using the format function in report

Post by Stephan1 »

Hi,

i got a problem using the Format function in my report.

i got a datetime field in my datatable which stores the payment date etc..

01.01.2008 17:34:25

i want to print the date without the timevalue on my report.

i tried using the format function like this

format(WaWi_VKBelegeZKD.Nettodatum, "Short Date")

but this also prints me 01.01.2008 17:34:25.

i also tried using "dd.mm.yyyy". doesnt work too.

Seems that the format type is ignored.

Can you please help ?

Thx

Stephan
Stephan1
Posts: 122
Joined: Fri Aug 31, 2007 7:22 am
Location: Germany

using the format function in report

Post by Stephan1 »

Think i found a solution.

Now iam using.

MyLinezkd.Append(" bis " & microsoft.VisualBasic.FormatDateTime(WaWi_VKBelegeZKD.Skontodatum2, microsoft.VisualBasic.DateFormat.ShortDate))

which works fine. Is this the Correct way ?..

Thx

Stephan
Brendan
Posts: 309
Joined: Sun Jul 16, 2006 12:42 pm
Location: Ireland

using the format function in report

Post by Brendan »

Hi Stephan,

If the Payment date is in a Text Field on its own you can use the TextFormat property of the Text component.
This is accessible in the designer from the Properties grid or by right clicking on the Text component and selecting "Text Format" from the context menu.

You can format your date with Format Editor window then.
If your date format isn't available via the "Date" list option you can select custom and you something like dd.MM.yyyy
Brendan
Posts: 309
Joined: Sun Jul 16, 2006 12:42 pm
Location: Ireland

using the format function in report

Post by Brendan »

Or if you wish to use the format function you can do the following for the text components expression:

Code: Select all

{Format("{0:MM.dd.yyyy}", MyPaymentDate)}
You can also use the ToString method for any datetime object.

Code: Select all

MyPaymentDate.ToString("MM.dd.yyyy");
MyPaymentDate.ToShortDateString();
MyPaymentDate.ToLongDateString();
Stephan1
Posts: 122
Joined: Fri Aug 31, 2007 7:22 am
Location: Germany

using the format function in report

Post by Stephan1 »

Thx Brendan.

Its a databasefield.

Your provided methods are working very well.

Thx.

Stephan
Post Reply