Check if date in past

Question:


How can I check if $olddate is earlier than $Now?

Answer:

If your store them as DateTime instead of as formatted strings, you can use the less-than operator (-lt) just like with regular numbers, and then use the format operator (-f) when you need to actually display the date:

Source:

Check if date in past by licensed under CC BY-SA | With most appropriate answer!

Leave a Reply