This website has been archived, it is working in read-only mode.

This website has been archived, it is working in read-only mode.

I need to convert date from a DATS data type to a formatted string, like yyyy-mm-dd, at runtime.

asked 20 Sep '11, 12:31

nuno's gravatar image

nuno ♦♦
162229
accept rate: 0%


Recent releases have a function module that allows generic formats

l_dat = '20110921'.
call function 'FORMAT_DATE_4_OUTPUT'
  exporting
    datin  = l_dat
    format = 'YYYY-MM-DD'
  importing
    datex  = l_str.

On older releases, that specific format YYYY-MM-DD, I think it has to be done by concatenation of substrings

concatenate l_dat(4) l_dat+4(2) l_dat+6(2) into l_str separated by '-'.
permanent link

answered 21 Sep '11, 07:20

pedrolima's gravatar image

pedrolima ♦♦
1.1k232840
accept rate: 32%

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×28
×3

question asked: 20 Sep '11, 12:31

question was seen: 113,428 times

last updated: 21 Sep '11, 07:20