cancel
Showing results for 
Search instead for 
Did you mean: 

validating date

Former Member
0 Kudos

Hi All,

I need to validate credit card expiry date. I need the date in MM YY format. I created a simple type and assiged this as the representation. But still it takes date in mmddyyyy format. I need to also check that date is valid and not expired.

Thank you

Regards,

Preet Kaur

Accepted Solutions (1)

Accepted Solutions (1)

ErvinSzolke
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi Preet,

please walk through the SAP note:

#947081 -- Locales, languages, date and time formats in Web Dynpro

(http://service.sap.com/sap/support/notes/947081)

Best Regards,

Ervin

Former Member
0 Kudos

Hi Ervin,

I went through the note you sent but is it possible if we take it as string and do such a validation.

Thank you

Regards,

Preet

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi All,

Found a solution. Created two drop down took the values as string. First got the system date then through format object got the month and the year then converted them to integer and checked whether the existing month and year are > or < the present.

Thank you

Regards,

Jaspreet

gill367
Active Contributor
0 Kudos

Hello Preet

Instead of using simple type and input field for validation.

What you can do is create two drop downs and seperate for both month and year.

Then validate accordingly.

Thanks

Sarbjeet Singh

Former Member
0 Kudos

Hi Sarabjeet,

Is it not possible if I do it by a input field and use the regex pattern for comparison. But need help in implementing the regex class as I just hv an idea about it.

Thanks

Regards,

Preet Kaur

gill367
Active Contributor
0 Kudos

Hello Preet

Give "MMyy" in the representation tab of the simple type

I thnk that will do.

MM --> caps

yy--> small letters

thanks

Sarbjeet

Former Member
0 Kudos

Hi Sarabjeet,

I already tried that...no luck ....I think this wud have to be done through regex...so working on that...if you have knowledege on it please let me know.

Thank you

Regards,

Preet Kaur

gill367
Active Contributor
0 Kudos

Hi

Sorry but i guess i am not able to understand your requirement properly.

If you just want the input field to take date as MMYY then you just need to bind it to the simple type having date as type and

format as MMyy.

then after that what you want to validate full date or date as MMYY?

Thanks

sarbjeet singh

Former Member
0 Kudos

Hi Sarabjeet,

I did as you told but whenever we enter any valid value then also it prompts the default error ie the format should be in the 1187 format although I have given same format ie 1110. As the 1st post suggests I think for dates it only supports ddMMyyyy or MMddyyyy.

Thank you

Regards,

Preet Kaur