I have something I'm stuck with.
My genealogy website uses full dates of birth (i.e. Wednesday 4th September 1975). These are manually entered in to the MySQL database and have been since the start so it's not an option for me to change them all to a DD-MM-YYYY format now.
What I WANT to be able to do is write a PHP script that will deconstruct the dates and give me an output which is in the DD-MM-YYYY format.
I tried the following as a starter (this is just a test code, usually the date of birth is acquired from MySQL as $dateofbirth):
Code: Select all
$dateofbirth = "Wednesday 4th September 1975";
$date1 = trim($dateofbirth, "Monday,Tuesday,Wednesday,Thursday,Friday,Saturday,Sunday");
$date2 = trim($date1, "st,nd,rd,th");Can anybody take this a stage further and suggest a way of writing a code that will take a full date and convert it to a more code-friendly format?
And whilst I'm on, I need to build in the ability to handle dates of birth entered as:
(Q1) 1975
c.1975 and
1975
Any ideas
Many, MANY thanks in advance.
Kris.