Sorting and date questions
Hello i want to ask you 2 things that i need to get done.
1st) I have made a page that lists some data pulled from a database , and i want to sort them by date asc , desc with a jump menu.
The date inserted in to the database has the format yyyy-mm-dd . I made this little script that currently do the job
<?php
$timestamp = strtotime($row_kiniseis['date']);
$newdate = date("l d F Y", $timestamp);
echo $newdate;
?>
Now the "problem" is that when i insert a record i type the date format in to the text box, like i mentioned above (yyyy-mm-dd) cause in any other case the data base shows "0000-00-00"
<----Is they any way to type the date format dd--mm-yyyy and this will be stored in the database as yyyy-mm-dd?---->
I tried to display the date in my native language format (greek) using a function with 2 arrays for months and days , but the table i display the data (and also the date) is inside a repeated region and i was receiving a notice that the function has already be declared.
<----Is there any solution-work arround with this issue?---->
2nd)To sort data by date using a jump menu do i need a relational table with id , values= asc,desc, and description?
Or this can be done with an easier way?With data assist maybe?
Sorry if my mind goes to the harder first :)