So today i am going to properly start practical php development. In today video i will show you how to use echo and date in php.
I have used date function three times in this tutorial and use it with different text inside date().
<?php date("d-m-Y"); ?>
So for displaying date we use shortcut of day, month and year. so d for day, m for month and Y for year. You can use any thing in between them e.g. i use – to separate them.
Next i use below:-
<?php date("jS F Y"); ?>
In the above code j stands for day S stands for nd, rd etc for example 2nd, 3rd etc. F stands for name of month and Y stands for year. This code is case sensitive so if you use small s then it will not display true result.
Next i use this code to display time:-
<?php date("h:m:s a"); ?>
In the above code h stands for hour, m stands for minute, s stands for second and a stands for am or pm. So if you use A instead of a in the code above then it will display AM and PM in capital.
Do practice with these codes and change it with your own coding and experiment it. If you feel any problem in the code then comment on this article.