Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re: Displaying a Image based on date range

by kirbyk (Friar)
on Jul 13, 2005 at 20:47 UTC ( #474682=note: print w/ replies, xml ) Need Help??


in reply to Displaying a Image based on date range

I think you're on a track that will work. There are a lot of approaches.

I'd probably not load up all the files into an array - there might be a lot of them someday, and it's easy to check if a file exists.

So, in pseudocode (since you're asking for approach), something like:

use Date::Calc; # For date math my $day = some formatting to localtime... return if $day > $end_date; while ( $day > $start_date ) { # you'll have to either keep these in Y +YYYMMDD format, or do some more complicated comparison logic my $hopeful_filename = "images/$today"; if (-e $hopeful_filename) { return $hopeful_filename; } $day = Add_Delta_Days(...); # Subtract one from the day }
That should get you on the write path. perldoc Date::Calc for the exact syntact for Add_Delta_Days.

-- Kirby, WhitePages.com


Comment on Re: Displaying a Image based on date range
Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://474682]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (7)
As of 2014-12-27 10:36 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (177 votes), past polls