I am using .NET environment and wanted to track the expiration date found in credit cards. The date there is of the nature “MMYYYY”. What would be a recommended way to store this ? Should I just use .NET string or instead use the .NET DateTime object ?
Share
In almost all cases the easiest solution is often the best solution. Its easy to maintain, easy for other programmers to recognize, and may even keep you out of trouble (ints and strings can lead to localization problems and invalid values).
A
System.DateTimeis the best option and gives you flexibility for those cards that may also expire on a given day (they are rare, but they do exist, and may become more prevalent with temporary credit cards becoming popular). When storing the value just use theDateproperty of theSystem.DateTimestruct since that will disregard the time components.