06-08-2009 10:00 AM
Hi friends,
I have a small problem, actually i have a date field , the format of the date field is "dd.mm.yyyy" but my client asked the date compareson , incase the user enters the wrong format dd/mm/yyyy that time the system shows the error message.
for example
My date format = dd.mm.yyyy => 03.03.2009
incase the user enter the wrong format => 03/05/2009 in this case the user wants the message
how to compare the date field format "dots / - '.
thanks
chinnu
06-08-2009 10:09 AM
data: date(8) type c.
date = 12/06/2009
if date ca '/'
error message
endif.
06-08-2009 10:13 AM
Hi Brighside
Thansk for sending the answer, i have a small doubt,
what is the use of the 'ca',.
Thanks
chinnu
06-08-2009 10:14 AM
06-08-2009 10:13 AM
Hello,
The date format can be separated by dots or / depending on the date settings on your system.
You can avoid confusions on this by using write statement.
w_date1 = sy-datum.
Write w_date to w_date1.
You can compare the dates by taking it on to a character string and then use the EQ operator.
If w_date1 eq w_date2.
.....
endif.
Thanks,
Sowmya
06-08-2009 10:13 AM
Hi
The problem is to know which kind of variable you're using for field date, if it's SY-DATUM u can't know the output format used by user, because you always see the format YYYYMMDD.
U should consider the format depends on setting of the user.
Max