Credit Card Expiry Date

What is the best datatype to be used to store expiry date of credit card which only needs input of month and year.

Thanks
VanJavaAsked:
Who is Participating?
 
Muhammad Noman IqbalCommented:
one option could be you use date data type, and put the day as last day of the month in that case when you take input from gui you will be calculating the last day of month.

In this case when you compare your date on which your credit card transaction is happening, comparison would be easy rather extracting the month from date you will compare the dates.

Thanks
0
 
Guy Hengel [angelIII / a3]Billing EngineerCommented:
I would choose date, with 01 as day.
0
 
VanJavaAuthor Commented:
Is it ok if I'm using number(4)?
0
 
Guy Hengel [angelIII / a3]Billing EngineerCommented:
>Is it ok if I'm using number(4)?
you could do so, but why bother to make it more complicated than needed?...

btw: in oracle, to calculate the last dayof the month is called LAST_DAY().
however, as mentioned, I would still use the first day of the month, and calculate the "real" expiry date with:

SYSDATE < ADD_MONTHS(expiry_date, 1)



0
 
VanJavaAuthor Commented:
Thank you all
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.