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: 

Reg date format

Former Member
0 Kudos

Hi,

i would like to change date format, when I take sy-datum I m getting YYYYMMDD, I want to change to mm/dd/yyyy and also for example the date is 20050101, i want to convert to 01-Jan-2005. is it possible to do in R3 ?

I appreciate your help.

Thanks

kisu

6 REPLIES 6

former_member214131
Active Contributor
0 Kudos

Hello,

FM: CONVERT_DATE_FORMAT

Hope this helps you.

-Murugesh AS

Former Member
0 Kudos

Hi,

Try this out

Using the WRITE statement

***************************

data: gd_date(10). "field to store output date

  • Converts date from 20020901 to 01.09.2002

write sy-datum to gd_date dd/mm/yyyy.

  • Converts date from 20020901 to 01.09.02

write sy-datum to gd_date dd/mm/yy.

  • Using data manipulation techniques

************************************

data: gd_date(8). "field to store output date

  • Converts date from 20010901 to 01092001

gd_date(2) = sy-datum+6(2).

gd_date2(2) = sy-datum4(2).

gd_date+4(4) = sy-datum(4).

Hope this helps to solve a part of ur query.

Thanks & Regards,

Judith.

Former Member
0 Kudos

let's try this.

1. system
   -> user profile
    -> own data
     -> defaults tab
   choose date format you want.

2.If you do that, all the program in R3 will use that format.

but, if you want format like "01-Jan-2005", you must program it.

and there is a lot of fuctions...

I wish I could you help

Regards

Kyung Woo

0 Kudos

the internal format of date is always YYYYMMDD.

so you can use little bit of code to format the way you want.

to get 01-jan-2005, you need to convert the period date+4(2)

you can use function "MONTH_NAMES_GET" to conver for e.g 02 to 'FEB' / 'February'.

also you should read user date format from usr01 table (datfm) and convert accordingly.

Regards

Raja

andreas_mann3
Active Contributor
0 Kudos

Hi Kisu,

your question : i want to convert to 01-Jan-2005. is it possible to do in R3 ?

here's a poss. solution:

REPORT zdate017.
PARAMETERS date LIKE sy-datum DEFAULT sy-datum.

DATA : BEGIN OF rec,
year TYPE bkpf-gjahr,
month TYPE t247-mnr,
day(2) type n,
END OF rec.

DATA : BEGIN OF rec2,
day(2) type n,
t1 VALUE '-',
mtx TYPE t247-ktx,
t2 VALUE '-',
year TYPE bkpf-gjahr,
END OF rec2.

MOVE date TO rec.
MOVE-CORRESPONDING rec TO rec2.
SELECT SINGLE ktx FROM  t247 INTO rec2-mtx
       WHERE  spras  = sy-langu
       AND    mnr    = rec-month.

WRITE: / rec, 15 rec2.

regards Andreas

Former Member
0 Kudos

Hi Kishore,

A couple of your recent posts have not been marked as questions. So long as you're seeking some help in your post, please do mark the topic as question. In fact, that is the default option. I do not understand why you uncheck the option, when you are asking a question. You can only uncheck it if you're trying to provide some general information that you think may be of interest to the rest of the folks here.

Also, don't you think you should appreciate the interest with which people respond to your query? Make it a point to reward all the answers that have proven to be helpful to you or that have solved your problem.

Here are some of the posts that I think you should either get back to or reward.

I hate to make a post such as this one, but thought that somebody should do it. Hope you understand.

Regards,

Anand Mandalika.