Hey there,

On my last post we discussed about passing variables without the use of forms. For this post, let’s talk on some SQL Formatting, DATE FORMAT. If you noticed, in a database the date will be formatted in:

2017-11-15 –>This form which makes it difficult for others to read.

So we are gonna change that into this form:

15 / 11 / 2017

There is just ONE step to do this. And we’re gonna change the output part, not the input. So the data in the database will still remain in the yyyy-mm-dd form. Enough with the explanation, NOW It’s code time…

“SELECT *, DATE_FORMAT(Date,’%d / %m / %Y’) AS Date FROM staff” 


1. DATE_FORMAT( __ , __ )

– The first blank space inside the bracket is for your column name inside the table.

–  The second space is for how you want it to be formatted. It MUST be in ‘__’.

2. AS

– Plays a very crucial role, if you don’t put this it’s not gonna work

– OK, so now you’ve formatted it, but how will the computer recognize it? So, this newly formatted date is to be given a new name, so we put AS.

– In the above code, I gave the same name as it was in the table, and it’s not a problem.

– If you give it a different name from the one in the table, when echoing it, you should echo the same name.


– Specifies from which table is the Date column taken from.


Alright people, nice going. Hope to see you again in my next post.

Any inquiries, mail me at imdad@zeroprogrammer.com