I am working with dates, in both PHP as well as MySQL. EVerytime I use to convert date in unix format. But this time I have taken field in DB as date. But issue is it is taking yyyy-mm-dd format. I want to store it in dd-mm-yyyy format. Is this possible if I set default setting of DB. or each time I have to explode the dd-mm-yyyy format in PHP and convert it in YYYY-MM-DD format. Its my first query.
Second query is I wish to fetch the records from today's date. I mean dates after today's date. Like today then tomorrow then so on.... Is it possible to use order by on date field.
DATE_FORMAT()in MySQL ordate(strtotime())in PHP to put it in the format you want. It isn't that MySQL stores it as yyyy-mm-dd, just that it outputs it that way and expects it input that way.STR_TO_DATE()will also help you convert the date for insertion.