Check if date in past


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


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:


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

Leave a Reply