To find out the current year is leap year or not which
date() function we've to use.Give the syntax also
Answers were Sorted based on User's Feedback
Answer / palanisamy
we have to use the argument 'L' for the date function and it
will return 1 if the given year is leap year else it will
return 0
ex: date('L',$yourdate)
Is This Answer Correct ? | 8 Yes | 2 No |
Answer / krishna reddy ketha
NOTE:
IT IS ONLY FOR FIND OUT THE GIVEN YEAR IS
LEAP YEAR OR NOT.
CONDITION:
/*
leap year:
// is divisible by 4 and not by 100
// is divisible by 400
*/
if((year % 4 == 0 && year % 100 != 0) || year % 400 == 0)
printf("%d is a LEAP YEAR" + year);
else
printf("%d is NOT a LEAP YEAR" + year);
Is This Answer Correct ? | 5 Yes | 0 No |
to check the current year code is :
date("L");
output will be 1 coz 2008 is a leap year.
better way to check is :
$year=2008;
echo date("L",mktime(1,1,1,1,1,$year));
now you can check any year by just changing the value of
variable $year, this is called dynamic programming.
Is This Answer Correct ? | 4 Yes | 3 No |
Answer / mahesh
$dt = getdate();
$year = $dt['year'];
$month =
$array(1=>31,(($dt['year']-2000)%4?28:29),31,30,31,30,31,31,30,31,30,31);
if array[2]==29
then it is a leap year.
Otherwise Not
Is This Answer Correct ? | 0 Yes | 5 No |
How to get total number of elements used in array?
How do you get the Browser information?
What is multidimensional array in php?
how can i get USA time using php...
How do I run a php script?
How do you end a session in php?
What is the meaning of xdebug?
Which of the following represents the proper way to set a session variable? Answer: a. $_SESSION['foo'] = 'bar'; b. session_start(); c. session_set_save_handler ('myopen', 'myclose', 'myread', 'mywrite', 'mydelete', 'mygarbage'); d. $foo = $_SESSION['foo']; 2.When administering MySQL, you should make the data directory accessible via the operating system 3.which statement can be used to determine how the optimizer resolves a query
Specify array sort functions available in php ?
What would occur if a fatal error was thrown in your php program?
What are advantages of .htaccess?
Explain what does the function get_magic_quotes_gpc() means?