‎2008 Jul 04 6:27 AM
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.
‎2008 Jul 04 6:36 AM
Hi,
check this..
REPORT ZOMKAR_DATE_TEST .
data : a type string.
a = sy-datum.
WRITE: sy-datum .
skip.
write : / a.
Regards,
Omkaram.
‎2008 Jul 04 6:32 AM
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
‎2008 Jul 04 6:32 AM
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
‎2008 Jul 04 6:36 AM
Hi,
check this..
REPORT ZOMKAR_DATE_TEST .
data : a type string.
a = sy-datum.
WRITE: sy-datum .
skip.
write : / a.
Regards,
Omkaram.
‎2008 Jul 04 6:38 AM
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..
‎2008 Jul 04 6:44 AM
use this....
data : date(8) type c.
date = sy-datum.
write:/ date.
it will give you the output in your desired way...
thanks
‎2008 Jul 04 6:59 AM
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