on 05-19-2005 9:10 AM
Hi
Anybody knows how to use the RfcDateToDateTime?
Im displaying my data on a Datagrid. The date field shows 'YYYYMMDD'. I do not wish to display the data as such format.
Anybody could me show how to display the date field in this format: 'dd/mm/yyyy'?
I come across about the RfcDAteToDateTime but I do not know how to use.
Thank you.
Regards.
Hi,
This static function takes a string which represents a date in the SAP Applications format and returns a DateTime .NET type. Use this type as you wish.
For the format you requested you can write this (C#):
using SAP.Connector;
...
label1.Text = "19950125";
DateTime dt = RfcConvert.RfcDateToDateTime(label1.Text);
label2.Text = dt.ToString("dd/MM/yyyy");
Regards,
Ofer
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Well, I'm not a DataGrid expert... But -
there are several options here, and a simple way (depending on you code) is to call this convert function in a "foreach" loop on all rows of the table in the proxy. You can put this code right after the rfc function.
You code should look something like:
(I assuming you have a function that returns a Table and the table row is of type MY_STRUCT. You also have a field called "Result" in the proxy that is mapped to this table. )
foreach (MY_STRUCT row in this.sapProxy11.Result)
{
row.Date = RfcConvert.RfcDateToDateTime(row.Date);
}
Maybe not pretty, but should work.
Regards,
Ofer
User | Count |
---|---|
93 | |
11 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.