Php tutorial in urdu 5 – Using echo and date

By Published On: September 29, 2013

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. http://www.dailymotion.com/video/x2119v7_php-tutorial-in-urdu-5-using-echo-and-date_tech I have used date function three times in this tutorial and use it with different text inside date(). [code lang=”php”]<?php date("d-m-Y"); ?>[/code] So for displaying date we use shortcut of day, month and year. so d for day, m for month [...]


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.
http://www.dailymotion.com/video/x2119v7_php-tutorial-in-urdu-5-using-echo-and-date_tech

I have used date function three times in this tutorial and use it with different text inside date().

[code lang=”php”]<?php date("d-m-Y"); ?>[/code]

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:-

[code lang=”php”]<?php date("jS F Y"); ?>[/code]

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:-

[code lang=”php”]<?php date("h:m:s a"); ?>[/code]

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.


Share this article

Written by : Junaid Rehman

I am a blogger and freelance web developer by profession. I love to blog and learn new things about programming and IT World.

Follow us

A quick overview of the topics covered in this article.

Join our website

Our partner website gives you a good reading experience

Latest articles