Instruction
1
PHP function that reads the variables from the server date and time at the time of its execution, in a General form is written as:date()it is possible to transfer the pattern, according to which the function will format the result of their work. With this template function may look like this:date('H:i:s d.m.Y');When using the template, the current date and time will be presented like this:22:09:06 30.05.2011 Notation used in this format ('H:i:s d.m.Y'):- letter H in the first place puts the current clock time format from 00 to 23. If the number of hours less than 10, before it is inserted 0 (for example, 05). If the letter H replaced by G, then null will not be added. You can change the case of characters - instead of H and G to write h and g. In this case the watch will be presented in the format 0 to 12. That is 22 hours would be represented as 10 o'clock in the afternoon;- the letter i indicates where should be shown the minutes of the current time;- the letter s marks the position of the seconds in writing the date and time;- d: denotes the location of the day of the month in two-digit format (e.g., 02). If replacing d by j, then zero will not be added - the format of the numbers will be unique (i.e., not 02, and simply 2);- letter " m " shows that this position function should be the ordinal number of month in format 01 to 12. The replacement of m by n will change the format to 1 - 12 and replace it with the letter F will use the full name of the month (e.g. "August"). Letter " M " will mean the abbreviated localized month name (i.e. "Jun" instead of "August");- Litera y denotes the full four-digit representation of the year. If you change the register (y), then the year will be reduced to the last two digits (i.e. 11 instead of 2011);other useful formatting options this function it is possible to note the letter I - it allows you to specify the date action on the server "DST", and the letter O shows server time zone (i.e. time shift relative to the Greenwich Meridian). Litera W calculates the sequence number of the current week of the year, and w and D displays the day of the week in numeric and text format, respectively. Using the letter L can be added to format the date in a leap year.
2
This information about the function date() is sufficient for transition to the practical part of the solution.Step 1: Start a text editor and create a new document.Step 2: Write in the document the script is only one line of PHP code:<?php echo date('H:i:s d.m.Y'); ?>Make sure that the icon " < " is the first sign this document in front of him and there are no spaces or empty lines.Step 3: based On the above information, make the format of the output date and time that you are most comfortable with, and replace with the desired letters inside the quotation marks in the function code.Step 4: save the document to a file with a php extension (for example, getDate.php and upload it to the server.Step 5: type in browser the address of the loaded page. You will see the current date and time on the server in a specified format.