Hi, We have a date input come in the format of YYYYMMDD,
ex: if the date comes as 19980224, then its good
else if the date comes as 19982402, then we need to raise exception
we need to validate this date format. can you please guide me how to do this?

Recommended Answers

All 2 Replies

One hint.

import time

date = 19980224
print time.strptime(date, '%Y%m%d')

date = 19982402
print time.strptime(date, '%Y%m%d')

Cheers and Happy coding

Hey Slayer, in fact I also got this hint and I appreciate your reply and waiting looking forwarded to other answers for my future questions.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.