in reply to Date Display
perldoc -f localtime is the traditional starting place for date & time. Pay particular attention to the "odd" values returned for the month & year.
As you probably already know, the slightly tricky part is getting the leading zeros. You can do something basic, like:
Or, you could use a standard function which allows you to specify padding values for fields (sprintf), An even better choice is strftime, which was especially written to handle date/time values. This site is a treasure trove of articles written by people who have asked similar questions in the past. The best way to find this material is to use Super Search. I just did, and found several articles that will help you with this question.($day < 10) && ($day = "0$day"); ($month < 10) && ($month = "0$month");
|
|---|