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: 

Date Conversion - Unidentified Format

former_member194669
Active Contributor
0 Kudos

All,

I am getting a text file with column contains the date contains the following values.

070321

070331

I wanted to how to convert this into correct date values.

If i open in this excel and format the column with date then i getting the value as

7/11/2092

7/21/2092

Any info?

a®s

Moderator message: date conversion questions = FAQ, please search for available information before posting.

Edited by: Thomas Zloch on Nov 15, 2010 12:55 PM

4 REPLIES 4

kesavadas_thekkillath
Active Contributor
0 Kudos

This is not a kind of question that you ask .

Anyways,

I think you have to use the conversion mask INVDT ( conversion exit )

For example table tcurs & field gdatu

Former Member
0 Kudos

The question is:

070321 = 7/11/2092?

070331 = 7/21/2092?

Or is it:

070321 = 21 march 2007? or 07 march 2021?

former_member536879
Active Contributor
0 Kudos

Hi,

Can you please tell me from where are you getting this file.

is this file is given by the FC? If so better you should ask the FC to maintain this in a proper way .

With Regards,

Sumodh.P

Former Member
0 Kudos

Hi,

Use below FM to solve your issue.

CONVERT_DATE_TO_INTERNAL.

Code as below:

report zsplit_string.

data:udate1(10) type c.

data:v_date(10) type c.

parameters:udate type char10.

udate1 = udate.

perform convert_date using udate1

changing v_date.

write:/ v_date.

&----


*& Form CONVERT_DATE

&----


  • text

----


  • -->P_UDATE1 text

  • <--P_V_DATE text

----


form convert_date using p_udate1

changing p_v_date.

call function 'CONVERT_DATE_TO_INTERNAL'

exporting

date_external = udate

accept_initial_date = space

importing

date_internal = v_date

exceptions

date_external_is_invalid = 1

others = 2.

if sy-subrc <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

endif.

concatenate v_date4(2) v_date6(2) v_date+0(4) into v_date separated by '/'.

endform. " CONVERT_DATE

Regards,

Venkat.