Within the php tag, the code should be
echo date('l jS \of F Y h:i:s A');
l - A full textual representation of the day of the week
j - Day of the month without leading zeros
S - English ordinal suffix for the day of the month, 2 characters
F - A full textual representation of a month, such as January or March
Y - A full numeric representation of a year, 4 digits
h - 12- hour format of an hour without leading zeros
i - Minutes with leading zeros s - Seconds, with leading zeros
A - Uppercase Ante meridiem and Post meridiem
(PHP.NET 2010)
Reference
PHP.NET, 2010, "date", viewed by 25 March 2010,
As I had taken UNIX programming last semester, I feel that php has a little bit similar as Unix code. Unix also using "echo" to display word on terminal. The different is Unix command need to add a preceding symbol - % (percent) in front of the parameter.
As refer to the PHP.NET, I using the backslash(\) to omit the "of" word which will display the correct date format without showing any error.
As PHP is a server side programming, so when I click to view the source code, it will show the current date only without show my original code. I think it is good to protect our source code without expose to everyone.
I already upload this php file to my website.
The following is a link of my website and this php file is under "Weekly Practical" folder:
http://www-student.it.uts.edu.au/~xiaoxzha/
The absolute link for this week exercise is http://www-student.it.uts.edu.au/~xiaoxzha/Weekly%20Practical/week4prac.php

No comments:
Post a Comment