Showing posts with label advanced. Show all posts
Showing posts with label advanced. Show all posts

Monday, April 5, 2010

date() Function

In the previous tutorial, you have learned the basic knowledge about PHP. I guess you all have mastered the previous tutorial so we can easily move on to the advanced tutorial. In the next tutorial, you will learn more details about PHP functions to make your system more compatible, reliable, and more interested. So, here we go!

date() Function

Syntax:



Here is the description:
  • format - specifies the format of the timestamp (required).
  • timestamp - specifies a timestamp. Default is the current date and time (optional).



Format the Date

Here are some description about the character we will used:
  • d - represents the day of the month (01-31).
  • m - represents a month (01-12).
  • Y - represents a year (in 4 digits).
You can also insert the characters like "/", "." or "-" between the letters to add additional formatting:


(click image to view)

############################################################
The Output:

2010/04/05
2010.04.05
2010-04-05
############################################################



Adding a Timestamp

The mktime() function return the Unix timestamp for a date. The Unix timestamp contains the number of seconds between the Unix epoch (January 1 1970 00:00:00 GMT) and the time specified.

Here is the syntax for mktime():



Lets see the example shows below:


(click image to view)

############################################################
The Output:

Yesterday was 04-04-2010
############################################################

Saturday, April 3, 2010

Introduction to PHP Dummy

Hi everyone. In this tutorial, i will show you (especially for dummies) how to expert in PHP programming language. But first, you must know the basic of PHP. So, from now on, i will post the basic tutorial about PHP. If you have mastered the basic tutorial, then we can proceed to the advanced level of PHP language.

Another thing you all need to know is in this tutorial, you will find complete references of all PHP functions that i will post later. So, good luck everyone!