The following is used to get the first day of the month and yesterdays date to put in as parameters:
@t = localtime();
$tmon = $t[4] + 1;
$tmon = "0" . $tmon if ($tmon < 10);
$tyear = $t[5] + 1900;
$firstday = join("-", "01", $tmon, $tyear);
$time = time();
@y = localtime($time - 86400); # 1 day is 86400 seconds
$ymon = $y[4] + 1;
$ymon = "0" . $ymon if ($ymon < 10);
$ymday = $y[3];
$ymday = "0" . $ymday if ($ymday < 10);
$yyear = $y[5] + 1900;
$ydate = join("-", $ymday, $ymon, $yyear);
my $repres = $ARGV[0];
my $ini = "'".$firstday."'";
my $fim = "'".$ydate."'";
How do I change this so I can say that if todays date is the first day of the month, then the program should get the first day of last month and yesterdays date?
Something like this:
if today = 1 then (FirstDay) of Month-1 and Yesterday else
FirstDay and Yesterday. Michel, São Paulo, Brazil
@t = localtime();
$tmon = $t[4] + 1;
$tmon = "0" . $tmon if ($tmon < 10);
$tyear = $t[5] + 1900;
$firstday = join("-", "01", $tmon, $tyear);
$time = time();
@y = localtime($time - 86400); # 1 day is 86400 seconds
$ymon = $y[4] + 1;
$ymon = "0" . $ymon if ($ymon < 10);
$ymday = $y[3];
$ymday = "0" . $ymday if ($ymday < 10);
$yyear = $y[5] + 1900;
$ydate = join("-", $ymday, $ymon, $yyear);
my $repres = $ARGV[0];
my $ini = "'".$firstday."'";
my $fim = "'".$ydate."'";
How do I change this so I can say that if todays date is the first day of the month, then the program should get the first day of last month and yesterdays date?
Something like this:
if today = 1 then (FirstDay) of Month-1 and Yesterday else
FirstDay and Yesterday. Michel, São Paulo, Brazil