2013 Apr 29 10:10 AM
Hello ,
I have a ABAP program that creates an XML file and everything is fine. I just need one date field in XML to conform to W3CC standard (EX: 2006-12-01T10:53:05.2170000). I need datetime in the format "2006-12-01T10:53:05.2170000". How do I acheive this in ABAP?
Thanks.
2013 Apr 29 11:31 AM
Hi Gouse , Try the Below Code ....
DATA : lv_timestamp TYPE timestampl,
lv_xml_date TYPE string.
GET TIME STAMP FIELD lv_timestamp.
CONCATENATE lv_timestamp+0(4)
lv_timestamp+4(2)
lv_timestamp+6(2)
INTO lv_xml_date
SEPARATED BY '-'.
CONCATENATE lv_xml_date
'T'
INTO lv_xml_date.
CONCATENATE lv_timestamp+8(2)
lv_timestamp+10(2)
lv_timestamp+12(2)
INTO lv_xml_date+12(8)
SEPARATED by ':'.
CONCATENATE lv_xml_date
lv_timestamp+5(7)
INTO lv_timestamp
SEPARATED BY '.' .
hi ,
try with
CONVERT TIME STAMP TIME_STAMP TIME ZONE TZ
INTO DATE DAT.
Thanks,
Vish
2013 Apr 29 11:22 AM
You will have to format the date field as required from ABAP and send to XML.
2013 Apr 29 11:27 AM
Hi,
Try this code
data: lv_var(50) type c.
CONCATENATE sy-datum+0(4) '-' sy-datum+4(2) '-' sy-datum+6(2) 'T' sy-uzeit+0(2) ':' sy-uzeit+2(2) ':' sy-uzeit+4(2) '70000' INTO lv_var.
2013 Apr 29 11:29 AM
hi ,
try with
CONVERT TIME STAMP TIME_STAMP TIME ZONE TZ
INTO DATE DAT.
Thanks,
Vish
2013 Apr 29 11:31 AM
Hi Gouse , Try the Below Code ....
DATA : lv_timestamp TYPE timestampl,
lv_xml_date TYPE string.
GET TIME STAMP FIELD lv_timestamp.
CONCATENATE lv_timestamp+0(4)
lv_timestamp+4(2)
lv_timestamp+6(2)
INTO lv_xml_date
SEPARATED BY '-'.
CONCATENATE lv_xml_date
'T'
INTO lv_xml_date.
CONCATENATE lv_timestamp+8(2)
lv_timestamp+10(2)
lv_timestamp+12(2)
INTO lv_xml_date+12(8)
SEPARATED by ':'.
CONCATENATE lv_xml_date
lv_timestamp+5(7)
INTO lv_timestamp
SEPARATED BY '.' .
2013 Apr 29 11:53 AM
In NW ABAP 7.3 Ehp 1 you can find a class named CL_REST_HTTP_UTILS. The method FORMAT_HTTP_DATE creates a date/time fomat according to RFC 822 (ie. "
Sat, 29 Oct 1994 19:43:31 GMT").
And of course there is a reverse method: PARSE_HTTP_DATE
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |