To display current date,no.of days and weeks in a month and year using php

1:Create new php file and copy the code and save it as file1.php.

2.Run file1.php, then it will display the current date and no.of days,weeks in a month and year.

[php]
<?php
echo  "My name is: John"."<br/>";
echo "current date is:"."\n" .date("Y m d h: s: m") ."<br/>";
echo "No of days in a month:"."\n" .cal_days_in_month( CAL_GREGORIAN, 07, 2010) ."<br/>";
echo "No of weeks in a month:"."\n".date("w", mktime(0,0,0,12,31,2010)) ."<br/>";
echo "No of weeks in a year:"."\n" .date("W", mktime(0,0,0,12,31,2010)) ."<br/>";
?>
[/php]

It display the output as:

My name is: John
current date is: 2010 07 23 04: 46: 07
No of days in a month: 31
No of weeks in a month: 5
No of weeks in a year: 52

No comments yet.

Leave a comment

Request a Free SEO Quote