Application Development and Automation 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: 
Read only

problem with system date

Former Member
0 Likes
981

Hi all,

I want to get the date format as 'yyyymmdd'. but when i try to print SY-DATUM it is giving in 'dd.mm.yyyy' format.

i have used EDIT MASK. but it is not working.

i have written as

write:/ sy-datum using edit mask 'yyyymmdd'

could anyone help me in this issue? its very urgent.

points will be rewarded.

regards,

Santosh.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
928

Hi,

check this..


REPORT  ZOMKAR_DATE_TEST                        .



data : a type string.
a = sy-datum.

WRITE: sy-datum .
skip.
write : / a.

Regards,

Omkaram.

6 REPLIES 6
Read only

Former Member
0 Likes
928

HI,

Try this sample coding to change the date format.

Sample Code is,

data: yymmdd(6) type c value '170109'.

data: yyyymmdd type sy-datum.

data: mmddyy(6) type c.

mmddyy0(2) = yymmdd2(2).

mmddyy2(2) = yymmdd4(2).

mmddyy4(2) = yymmdd0(2).

call function 'CONVERT_DATE_TO_INTERN_FORMAT'

exporting

datum = mmddyy

dtype = 'DATS'

importing

ERROR =

idate = yyyymmdd.

MESSG =

MSGLN =

write:/ yyyymmdd.

hope this helps you.

Reward points if helpfull

Thanks & Regards,

Y.R.Prem Kumar

Read only

Former Member
0 Likes
928

Hi,

try this out.

DATA: day(2) TYPE c,

month(2) TYPE c,

year(4) TYPE c,

delimiter(1) TYPE c value '.',

date type sy-datum,

altered_date(8) TYPE c.

date = sy-datum.

SPLIT date AT delimiter INTO day month year.

CONCATENATE year month date INTO altered_date.

Reward if helpful.

Regards,

Prosenjit.

Edited by: prosenjit chaudhuri on Jul 4, 2008 7:34 AM

Read only

Former Member
0 Likes
929

Hi,

check this..


REPORT  ZOMKAR_DATE_TEST                        .



data : a type string.
a = sy-datum.

WRITE: sy-datum .
skip.
write : / a.

Regards,

Omkaram.

Read only

Former Member
0 Likes
928

hi,

simply take a char variable for date.

and concatenate the system year system month and system date i mean watever format you want, using offsets into ths char date variable..

this will solve your problem..

Read only

Former Member
0 Likes
928

use this....


  data : date(8) type c.
  date = sy-datum.

write:/  date.

it will give you the output in your desired way...

thanks

Read only

Former Member
0 Likes
928

Hello Santosh,

By default SY-datum will store the date format in the system as 'yyyymmdd'. But the reason it is displaying you in other format is because of your system settings. SY-datum will automatically displays the date format according to your system format.

Check this > System> User Profile--> Own data.

Do this in the Developement server....You can see the system format that you are using.

It will be dd.mm.yyyy.

If this is the format that you are using in your system then your issue is fixed....Because, you have to display a Date format depending upon the users profile. If the User system has another date format then it will not accept. This is how it works..This is SAP standard setting.

Please let me know if it does not solve your issue..

Regards,

Kittu