cancel
Showing results for 
Search instead for 
Did you mean: 

Date in different formats

0 Kudos

Hello All,

I have requirement in SAP script where I need to compare the system date and condition validity date and display the value if todays date lies in validity date. What is the best way to do this , I have tried using a perform statment but the date when being passed into the program is appearing in different formats in dev server (dd.mm.yyyy) and test servers(yyyy.mm.dd), I have checked the user settings and they are similar why is the date being passed in different formats.

Thanks in advance,

ranjan

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi,

In user settings the dates are in same format definately it will come like that only.

I think the format what you said in testing is from debugging only in debugging it will show like that only

if not use the offsets like g_date0(4), g_date4(2), G_date+6(2).

Else.( g_validity_date-low le g_date and g_validity_date-high ge g_date ) is enough in your program lines.

Thanks,

Phani.

Edited by: phani kumar on Jul 30, 2009 11:05 PM

Former Member
0 Kudos

Hi Ranjan,

or if you want to compare two dates.

use the FM "CONVERT_DATE_TO_INTERNAL " it converts user setting date to internal format YYYYMMDD

then you can compare

USe the FM "CONVERT_DATE_TO_EXTERNAL " it converts the input date to user setting format it is (dd.mm.yyyy) and test servers(yyyy.mm.dd),


data : formatted_date(10).
 WRITE sy-datum  TO formatted_date MMDDYYYY.

Now for all users the date format will appear MMDDYYYY regardless to user setting.

Prabhudas