Page 1 of 1

using the format function in report

Posted: Fri Jan 11, 2008 2:43 am
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

using the format function in report

Posted: Fri Jan 11, 2008 3:01 am
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

using the format function in report

Posted: Fri Jan 11, 2008 4:14 am
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

using the format function in report

Posted: Fri Jan 11, 2008 4:20 am
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();

using the format function in report

Posted: Fri Jan 11, 2008 4:57 am
by Stephan1
Thx Brendan.

Its a databasefield.

Your provided methods are working very well.

Thx.

Stephan