Java Techies- Solution for All
Date()
The PHP date() function is use to display the format a time and/or date.
Syntax :
date(format,timestamp)
format : format of the timestamp.
timestamp : It gives date and time of day.
Example :
<?php echo date("Y.m.d") . "<br>"; echo date("Y-m-d"); ?>
Output :
2013.07.18 2013-07-18
Date()-Adding a Timestamp
mktime():function returns the Unix timestamp for a date.
Syntax :
mktime(hour,minute,second,month,day,year,is_dst)
Example :
<?php $NextDate = mktime(0,0,0,date("m"),date("d")+1,date("Y")); echo "Tomorrow is ".date("Y/m/d", $NextDate); ?>
Output :
Tomorrow is 2013/07/19
include
- If you want to add one PHP file to another PHP file through
include
andrequire
. - when you want to change something your functions, you will have to do it only once.
Syntax :
include 'filename'; or require 'filename';
Example :
//header.jsp <?php echo "Header JSP"; ?> //footer.jsp <?php echo "footer JSP"; ?> //test.php <?php include 'header.php'; echo "<h4>Welcome to my home page!</h4>"; include 'footer.php'; ?>
Output :
Header JSP Welcome to my home page! footer JSP