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 ♦♦
accept rate: 0%

Recent releases have a function module that allows generic formats

l_dat = '20110921'.
call function 'FORMAT_DATE_4_OUTPUT'
    datin  = l_dat
    format = 'YYYY-MM-DD'
    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 ♦♦
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



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:


question asked: 20 Sep '11, 12:31

question was seen: 112,837 times

last updated: 21 Sep '11, 07:20