Thanks so much. I think it's a good way :) Now, I can't get the date printed in that format!
Here is the code I have: sub DATEJOINEDRAW{ my %arg = @_; if ($arg{USER}) { my $UserID = $arg{USER}->get(field => 'UserID'); if ($UserID) { my %arg = @_; my $query = "select RegistrationDate FROM USERS where UserID=$UserID;"; my $sdb = $arg{DBOBJ}->prepare($query); $sdb->execute; my($reg)=$sdb->fetchrow; return $reg; } } return '0'; } This prints the date, but in order to get the raw data, I don't know what to do! I tried using the DATE_FORMAT, but it's not working: sub DATEJOINEDRAW{ my %arg = @_; if ($arg{USER}) { my $UserID = $arg{USER}->get(field => 'UserID'); if ($UserID) { my %arg = @_; my $query = "select DATE_FORMAT(RegistrationDate, '%Y %M %D') FROM USERS where UserID=$UserID;"; my $sdb = $arg{DBOBJ}->prepare($query); $sdb->execute; my($reg)=$sdb->fetchrow; return $reg; } } return '0'; } Any help would be appreciated. Soheil -----Original Message----- From: Felix Geerinckx [mailto:[EMAIL PROTECTED]] Sent: Monday, August 26, 2002 1:40 PM To: [EMAIL PROTECTED] Subject: Re: Question about dates on Mon, 26 Aug 2002 20:37:22 GMT, Soheil Shaghaghi wrote: > I want to sell a service. > I have a form where the user comes to purchase the service. > I can get the date from SQL database in any format and display it in > form. > > At this point, when the user fills out the form and submits it, I > want to look at the date. > If the date is before August of 2002, the price should be set to > $25.00, and if it's after August of 2002, it will be $50.00 You may want to consider returning the date in two formats from your SQL query. One for comparing and one for displaying. If you take the format 'yyyymmdd', the comparison is easy: if ($date lt '20020801') { $price = 25; } else { $price = 50; } You may also want to consider working in cents instead of dollars, to avoid rounding errors. -- felix -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]