The date Function

Author Topic: The date Function  (Read 797 times)

Offline chinmay.sahooTopic starter

  • Trade Count: (0)
  • Full Member
  • ***
  • Thank You 2
  • Posts: 139
  • Karma: 0
    • No Addiction
The date Function
« on: 12-19-2015, 02:55:07 »
PHP has a very powerful function named date which enables information about the current date and time to be obtained and displayed in a very fl exible way. The date function takes one argument, which can be a string of any length. It reads the system clock to fi nd out the date and time and then returns a string constant with part or all of that information presented in a suitable form, which depends on the string that was given to it as its argument.

We will start by illustrating the effect of calling the function with a one-character string as its argument. If we assume that today is Christmas Day 2018, the function call date("d") will return the string "25", date("F") will return "December" and date("Y") will return "2018".

If the argument is more than one character the string returned is the combination of all the strings returned by the individual characters joined together. So date("dFY") returns the string "25December2018".

A list of the main characters that can be used in the argument of a date function and the outputs they produce is given at the end of this section. Any other characters can also be used. Those that do not have a special meaning return themselves. These include characters such as space, colon, dot and minus (or hyphen), which can be used as separators. Thus executing the instruction


Related Topics

  Subject / Started by Replies Last post
0 Replies
Last post 09-10-2011, 11:36:41
by Maddy
0 Replies
Last post 11-03-2011, 04:37:50
by manvbf
0 Replies
Last post 04-09-2012, 14:45:41
by kirklott
2 Replies
Last post 06-22-2015, 08:12:08
by DigitalSuccessAgency
0 Replies
Last post 09-27-2016, 02:25:44
by QuarkJacks