Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

converting any format of date to yyyymmdd format

Former Member
0 Kudos
16,382

Hi,

iam having a flat file which i need to upload to the tables . in that file i have date fields. right now my user has given the date in yyyymmdd format . in production the format may be yyyymmdd or ddmmyyyy.

so whatever the format they provide in flat file i want to find the year month and date .so iam not able to use offset to find the year month and date. is there any function module which converts any format of date to yyyymmdd format.

Thanks,

Rose.

8 REPLIES 8

GauthamV
Active Contributor
0 Kudos
3,522

hi,

check this function module.

CONVERT_DATE_TO_INTERNAL

Former Member
0 Kudos
3,522

Hi,

you can set mask the date in text elments.

and also you ve one function module as

CONVERT_DATE_TO_INTERN_FORMAT

to convert the date as you like internally.

PS: Do award points if helps

Former Member
0 Kudos
3,522

hi,

in whatever format u give to the screen field it will interpret the value into the internal format of the system

thus it is not required to change the date as per the system using offset and length but use conversion-exit

there are many conversion-exits go to se37 and find out the conversion_exit for converting the date into internal format.

if u are not able to find it reply me

reward points if useful

Former Member
0 Kudos
3,522

Hi,

Try the FM 'CONVERT_DATE_TO_INTERNAL'.

CONVERT_DATE_TO_EXTERNAL Conversion: Internal to external date (like screen conversion)

CONVERT_DATE_TO_INTERNAL Conversion: External to internal date (like screen conversion)

Regards,

SB

former_member206377
Active Contributor
0 Kudos
3,522

hi,

try this

Parameter: in_date(10) type C.

Data : out_date(10) type C.

CALL FUNCTION 'CONVERSION_EXIT_PDATE_INPUT'

EXPORTING

input = in_date

IMPORTING

OUTPUT = out_date

.

write : out_date.

Reward if useful

Regards,

Vasuki

former_member181995
Active Contributor
0 Kudos
3,522

Camila,

check with this:

'CONVERSION_EXIT_PDATE_INPUT'

Amit.

Former Member
0 Kudos
3,522

Hi

Just Follow the below procedure.


data :  wf_year(4)  TYPE C,          
          wf_month(2) TYPE C,          
          wf_date(2) TYPE C,            
          ws_date(8) TYPE C,.
    clear: ws_date,
            wf_year,
            wf_month,
            wf_date.
    ws_date = wa_master-budat. (Input fotmat date)
    wf_year = ws_date+0(4).
    wf_month = ws_date+4(2).
    wf_date = ws_date+6(2).
    concatenate   wf_year wf_month wf_date into ws_date.

Now the ws_date will have the contents as per your required format..if you want to change the concatenation order also u can change.

Thanks and Regards,

Arun Joseph

former_member387317
Active Contributor
0 Kudos
3,522

Hi camila phyrose,

I don't think so there exist such a function module which covert any date format ( 13.01.2008 01.13.2008 13 JAN 2008 13th Jan 2008 13 Jan 08 ....etc etc...) to yyyymmdd...

Refer below similar thread for detailed information...

Hope it will solve your problem

Thanks & Regards

ilesh 24x7