in reply to Re: Trying to order by date
in thread Trying to order by date

Year is not a problem and actually i dotn wanty it:
So the solutuon is to change this my $date = strftime( '%F %T', localtime ); to this? my $date = now();
and then insert it to the mysql database?

But then agian when i get th date column form the mysq table i want to print it in this format my $date = strftime( "%d %b, %H:%M", localtime );

Replies are listed 'Best First'.
Re^3: Trying to order by date
by Joost (Canon) on Aug 04, 2005 at 11:42 UTC
    No, you just want something like the following SQL:

    "UPDATE sometable SET datecolumn = NOW() where ID=..."

    There is no need to generate the date in perl.

    Update: by the way, YOU might not be interested in the year (as in, you might not want to show it) but the database can't sort the dates correctly if you don't supply a year: jan 2004 IS later than dec 2003, you see.

    Update2: if you have a datetime column, mysql can take care of the output formatting too. You desperately need to take a look at the mysql date and time functions instead of guessing.

    A reply falls below the community's threshold of quality. You may see it by logging in.