List:General Discussion« Previous MessageNext Message »
From:Douglas Brantz Date:March 11 2000 7:42am
Subject:Re: Help!! Time Alter Question?
View as plain text  
I am now trying the following to grab the individual pieces of the timestamp
to alter them:
---
my $sth1 = $dbh->Query("select year(tdin),month(tdin),dayofmonth(tdin),
hour(tdin),minute(tdin),second(tdin)
from timedata where
timeid=\"$newtimeid\" ")
or die $Mysql::db_errstr;
my @arr=();
while (@arr = $sth1->fetchrow)
{
($year,$month,$dayofmonth,$hour,$minute,$second)= @arr;
$inyear=$year;
$inmonth=$month;
$inday=$dayofmonth;
$inhour=$hour;
$inmin=$minute;
$insec=$second;
}
print "$inyear-$inmonth-$inday $inhour:$inmin:$insec</td></tr><td
align=right>";

I guess I need to know if it matters if I use year(tdin) or use
date_format(tdin, '%W')

And how can I alter the timestamp after I change all the info?
What is the best format for the time to be placed back into the timestamp?

Thanks
Douglas

------------------------------------------------------


Douglas Brantz wrote:

> Help!!!
> I would like to allow a person to alter the time field in a form.  What
> is the best way to present the info to the user without writing a very
> long script?
>
> Here is how I usually present a time field in perl-cgi.
>
> my $sth = $dbh->Query("select date_format(tdout, '%W %M %D %Y %r') from
> timedata where timeid=\"$newtimeid\" ")
> or die $Mysql::db_errstr;
> while (@record = $sth->FetchRow)  {
> $fool = $record[0]; $bar = $record[1];
> }
> print "$fool</td></tr><td align=right>";
>
> So, I would like to alter this time info in a form. Would I have to call
> each part one at a time, such as %W and create a drop down menu of all
> the Days of the week? and then after all that how can I put it all back
> together again and give the command TIME TO SEC and also Update Mysql
> with the new TIMESTAMP?
>
> I'm probably making it more difficult than it is.
>
> Thanks in advance.
>
> Douglas
> ASU

Thread
Help!! Time Alter Question?Douglas Brantz11 Mar
  • Re: Help!! Time Alter Question?Douglas Brantz11 Mar