variables

variables

am 10.04.2004 20:16:05 von amy parness

My first if statements are working and adding a 0 before numbers less than
or = to 9 but the second ones (fromdate and todate) are not working. They
are adding the +1 but not the 0 before numbers <=9. Does it have something
to do with it being in () in the main statement?

$x=0

if ($frommonthWidgetValue <= 9)
{
$frommonthWidgetValue = $x.$frommonthWidgetValue;
}
if ($fromdateWidgetValue <= 9)
{
$fromdateWidgetValue = $x.$fromdateWidgetValue;
}


if ($tomonthWidgetValue <= 9)
{
$tomonthWidgetValue = $x.$tomonthWidgetValue;
}
if ($todateWidgetValue <= 9)
{
$todateWidgetValue = $x.$todateWidgetValue;
}


$datestart= $x.$fromyearValue.
"-".$frommonthWidgetValue."-".($fromdateWidgetValue+1);
$dateend= $x.$toyearValue. "-" .$tomonthWidgetValue.
"-".($todateWidgetValue+1);

print $datestart



--
MySQL Perl Mailing List
For list archives: http://lists.mysql.com/perl
To unsubscribe: http://lists.mysql.com/perl?unsub=gcdmp-msql-mysql-modules@m .gmane.org

Re: variables

am 11.04.2004 05:26:41 von Mandrake981

Hi Amy... It would be much easier and more precise with the sprintf statement:

$datestart = $fromyearValue . "-" . sprintf("%02d",$frommonthWidgetValue) .
"-" . sprintf("%02d",$fromdateWidgetValue + 1);

$dateend = $toyearValue . "-" . sprintf("%02d",$tomonthWidgetValue) . "-" .
sprintf("%02d",$todateWidgetValue + 1);

print "$datestart\t$dateend\n";

If you have any questions, feel free to give me a shout off list...

--
Take care,
Randall Hobbs
Programmer - System Administrator - Chip Castle Dot Com, Inc.
Web Hosting * Programming * Software
http://www.chipcastle.com

On Saturday 10 April 2004 01:16 pm, amy parness wrote:
> My first if statements are working and adding a 0 before numbers less than
> or = to 9 but the second ones (fromdate and todate) are not working. They
> are adding the +1 but not the 0 before numbers <=9. Does it have something
> to do with it being in () in the main statement?
>
> $x=0
>
> if ($frommonthWidgetValue <= 9)
> {
> $frommonthWidgetValue = $x.$frommonthWidgetValue;
> }
> if ($fromdateWidgetValue <= 9)
> {
> $fromdateWidgetValue = $x.$fromdateWidgetValue;
> }
>
>
> if ($tomonthWidgetValue <= 9)
> {
> $tomonthWidgetValue = $x.$tomonthWidgetValue;
> }
> if ($todateWidgetValue <= 9)
> {
> $todateWidgetValue = $x.$todateWidgetValue;
> }
>
>
> $datestart= $x.$fromyearValue.
> "-".$frommonthWidgetValue."-".($fromdateWidgetValue+1);
> $dateend= $x.$toyearValue. "-" .$tomonthWidgetValue.
> "-".($todateWidgetValue+1);
>
> print $datestart

--
MySQL Perl Mailing List
For list archives: http://lists.mysql.com/perl
To unsubscribe: http://lists.mysql.com/perl?unsub=gcdmp-msql-mysql-modules@m .gmane.org

Re: variables

am 11.04.2004 05:26:41 von Mandrake981

Hi Amy... It would be much easier and more precise with the sprintf statement:

$datestart = $fromyearValue . "-" . sprintf("%02d",$frommonthWidgetValue) .
"-" . sprintf("%02d",$fromdateWidgetValue + 1);

$dateend = $toyearValue . "-" . sprintf("%02d",$tomonthWidgetValue) . "-" .
sprintf("%02d",$todateWidgetValue + 1);

print "$datestart\t$dateend\n";

If you have any questions, feel free to give me a shout off list...

--
Take care,
Randall Hobbs
Programmer - System Administrator - Chip Castle Dot Com, Inc.
Web Hosting * Programming * Software
http://www.chipcastle.com

On Saturday 10 April 2004 01:16 pm, amy parness wrote:
> My first if statements are working and adding a 0 before numbers less than
> or = to 9 but the second ones (fromdate and todate) are not working. They
> are adding the +1 but not the 0 before numbers <=9. Does it have something
> to do with it being in () in the main statement?
>
> $x=0
>
> if ($frommonthWidgetValue <= 9)
> {
> $frommonthWidgetValue = $x.$frommonthWidgetValue;
> }
> if ($fromdateWidgetValue <= 9)
> {
> $fromdateWidgetValue = $x.$fromdateWidgetValue;
> }
>
>
> if ($tomonthWidgetValue <= 9)
> {
> $tomonthWidgetValue = $x.$tomonthWidgetValue;
> }
> if ($todateWidgetValue <= 9)
> {
> $todateWidgetValue = $x.$todateWidgetValue;
> }
>
>
> $datestart= $x.$fromyearValue.
> "-".$frommonthWidgetValue."-".($fromdateWidgetValue+1);
> $dateend= $x.$toyearValue. "-" .$tomonthWidgetValue.
> "-".($todateWidgetValue+1);
>
> print $datestart

--
MySQL Perl Mailing List
For list archives: http://lists.mysql.com/perl
To unsubscribe: http://lists.mysql.com/perl?unsub=gcdmp-msql-mysql-modules@m .gmane.org

Re: variables

am 11.04.2004 14:07:00 von Jamie McCarthy

Mandrake981@cox.net (Randall D. Hobbs) writes:

> Hi Amy... It would be much easier and more precise with the
> sprintf statement:
>=20
> $datestart =3D $fromyearValue . "-" .
> sprintf("%02d",$frommonthWidgetValue) . "-" .
> sprintf("%02d",$fromdateWidgetValue + 1);

or

$datestart =3D sprintf("%04d-%02d-%02d",
$fromyearValue,
$frommonthWidgetValue,
$fromdateWidgetValue + 1);
--=20
Jamie McCarthy
http://mccarthy.vg/
jamie@mccarthy.vg

--
MySQL Perl Mailing List
For list archives: http://lists.mysql.com/perl
To unsubscribe: http://lists.mysql.com/perl?unsub=3Dgcdmp-msql-mysql-modules @m.gmane.org

Re: variables

am 11.04.2004 14:07:00 von Jamie McCarthy

Mandrake981@cox.net (Randall D. Hobbs) writes:

> Hi Amy... It would be much easier and more precise with the
> sprintf statement:
>=20
> $datestart =3D $fromyearValue . "-" .
> sprintf("%02d",$frommonthWidgetValue) . "-" .
> sprintf("%02d",$fromdateWidgetValue + 1);

or

$datestart =3D sprintf("%04d-%02d-%02d",
$fromyearValue,
$frommonthWidgetValue,
$fromdateWidgetValue + 1);
--=20
Jamie McCarthy
http://mccarthy.vg/
jamie@mccarthy.vg

--
MySQL Perl Mailing List
For list archives: http://lists.mysql.com/perl
To unsubscribe: http://lists.mysql.com/perl?unsub=3Dgcdmp-msql-mysql-modules @m.gmane.org

Re: variables

am 11.04.2004 16:21:12 von Mandrake

You're right Jamie - and that's the way it should have been shown, but last
night I was so tired I wasn't even thinking straight (LONG day)... Thanks for
correcting that!

--
Take care,
Randall Hobbs
Programmer - System Administrator - Chip Castle Dot Com, Inc.
Web Hosting * Programming * Software
http://www.chipcastle.com

On Sunday 11 April 2004 07:07 am, Jamie McCarthy wrote:
> Mandrake981@cox.net (Randall D. Hobbs) writes:
> > Hi Amy... It would be much easier and more precise with the
> > sprintf statement:
> >
> > $datestart = $fromyearValue . "-" .
> > sprintf("%02d",$frommonthWidgetValue) . "-" .
> > sprintf("%02d",$fromdateWidgetValue + 1);
>
> or
>
> $datestart = sprintf("%04d-%02d-%02d",
> $fromyearValue,
> $frommonthWidgetValue,
> $fromdateWidgetValue + 1);
> --
> Jamie McCarthy
> http://mccarthy.vg/
> jamie@mccarthy.vg

--
MySQL Perl Mailing List
For list archives: http://lists.mysql.com/perl
To unsubscribe: http://lists.mysql.com/perl?unsub=gcdmp-msql-mysql-modules@m .gmane.org

Re: variables

am 11.04.2004 16:21:12 von Mandrake

You're right Jamie - and that's the way it should have been shown, but last
night I was so tired I wasn't even thinking straight (LONG day)... Thanks for
correcting that!

--
Take care,
Randall Hobbs
Programmer - System Administrator - Chip Castle Dot Com, Inc.
Web Hosting * Programming * Software
http://www.chipcastle.com

On Sunday 11 April 2004 07:07 am, Jamie McCarthy wrote:
> Mandrake981@cox.net (Randall D. Hobbs) writes:
> > Hi Amy... It would be much easier and more precise with the
> > sprintf statement:
> >
> > $datestart = $fromyearValue . "-" .
> > sprintf("%02d",$frommonthWidgetValue) . "-" .
> > sprintf("%02d",$fromdateWidgetValue + 1);
>
> or
>
> $datestart = sprintf("%04d-%02d-%02d",
> $fromyearValue,
> $frommonthWidgetValue,
> $fromdateWidgetValue + 1);
> --
> Jamie McCarthy
> http://mccarthy.vg/
> jamie@mccarthy.vg

--
MySQL Perl Mailing List
For list archives: http://lists.mysql.com/perl
To unsubscribe: http://lists.mysql.com/perl?unsub=gcdmp-msql-mysql-modules@m .gmane.org