How would one go about determining if something is 3 days old, 3 months old,
1 year old, etc., based on the following scenario?

The date that a user subscribes to our site is stored in a MySQL database in
the DATE format yyyy-mm-dd. So column 'SubscribeDate' looks like 2003-06-18,
for instance.

When I pull that value out of the column, how do I do a measurement to
determine its age?

<!-- snip -->

# Get username from form selection
my $subscriber = $q->param('user');

# Connect to DB
my $dbh = DBI->connect("DBI:mysql:db_name:localhost","usr","pass") or die
"Could not connect to DB: $!";

# Prepare and execute statement
my $sth = prepare("SELECT SubscribeDate FROM UserData WHERE UserName = ?");
$sth->execute($subscriber);
while(my($data) = $sth->fetchrow_array) {
 my $subscription_age = # HOW WOULD I DETERMINE THIS?
 print qq($subscriber\'s account is $subscription_age old.\n);
}

$sth->finish();

<!-- /snip -->


Scot R.
inSite



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to