Duplicate
Dear All,
I have a PHP page where i wil be displaying some data from Mysql db. I have 2 dates to display on this page.In my db table, Date 1 is in the format d/m/Y (ex: 11/11/2002) and Date 2 is in the format d-m-Y (ex : 11-11-2002) I need to display both of this in the same format .The format i have stored in a variable $dateFormat=’m/d/Y’
Can any one guide me
Thanks in advance
Use
strtotimeto convert the strings into a Unix timestamp, then use thedatefunction to generate the correct output format.Since you’re using the UK date format ‘d/m/Y’, and strtotime expects a US format, you need to convert it slighly differently: