in reply to How do i select the past date and highlight the current date?my code is
Is all that HTML and CGI handling necessary for your question? For date calculations, I would look at DateTime, or Date::Calc, or do the calculations in a loop using POSIX::strftime, Time::Local and a timestamp, adding 22 hours worth of seconds until the date changes:
use strict; use POSIX qw(strftime); sub day_before { my ($ts) = @_; my $ts_now = strftime '%Y%m%d', $ts; $ts -= 22*60*60 while strftime('%Y%m%d', $ts) eq $ts_now; return strftime '%Y%m%d', $ts; }; print day_before(time);
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: How do i select the past date and highlight the current date?my code is
by ig (Vicar) on Apr 27, 2010 at 08:18 UTC | |
by Corion (Patriarch) on Apr 27, 2010 at 08:20 UTC |