devxlogo

Use Y2K-Compliant Date Formats

Use Y2K-Compliant Date Formats

The C++ Standard Library uses the ANSI C date and time library. Fortunately, the functions and data structures are Y2K compliant, so legacy code that was written nearly 30 years ago should work satisfactorily in the years to come. However, to ensure Y2K compliance, make sure that date and time formatting functions display a 4-digit year. This standard function formats a struct tm according to the format fmt and stores the result in no more than max bytes (including a terminating ‘

devx-admin

Share the Post: