Times and dates

Time conversation has touched date, we shall try to understand as all

It can be used in the own purposes.

In RNR most function date in a format $date=date (' parameter ') often is used;

Parameters can be a little, and they are divided{shared} among themselves by a point.

The list of allowable parameters.


a - "am" or "pm"

a - "am" or "pm"

d - day of month, digital, 2 figures (on the first place a zero)

d - day of week, text, 3 letters; i.e. "fri"

f - month, text, long; i.e. "january"

h - hour, a digital, 12-hour format

h - hour, a digital, 24-hour format

i - minutes, digital

j - day of month, digital, without initial zero

l (lower case ' l ') - day of week, text, long; i.e. "friday"

m - month, digital

m - month, text, 3 letters; i.e. "jan"

s - seconds, digital

s - English serial suffix, text, 2 symbols; i.e. "th", "nd"

u - seconds from the beginning of a century

y - year, digital, 4 figures

w - day of week, digital, 0 means Sunday

y - year, digital, 2 figures

z - day of year, digital; i.e. "299"


Pay attention to differences in the register. Each symbol in different registers has different functions.

Now you can easily receive the information on current time, and to use her  on the site.

One of the most widespread variants - a conclusion of current time and date.

Certainly, all this is done{made} without problems on javascript but who saw these scripts,

That will understand a difference (at least in size and speed of performance,

Let alone the traffic from the server to a browser).

Well, time in my opinion to deduce{remove} it is useless enough,

As it is at each user in tree windows-b, and to deduce{remove} number,

Month and day of week (moreover in Russian) happens it is useful.

Let's start with a greeting to the visitor. It would be not bad to deduce{remove} corresponding

Phrase depending on time of visiting. No sooner said than done:



<? php

$h=date (' h ');

if ($h> =5 ** $h <=11) echo " Good morning! ";

if ($h> =12 ** $h <=18) echo " Hello! ";

if ($h> =19 ** $h <=24) echo " Good evening! ";

if ($h> =1 ** $h <=4) echo " Kind night! ";

?>


Figures of desirable time it is possible to put down any, depending on personal concept of day and night:-)

The following step - a conclusion of number, day of week and a name of month. But before we shall start realization of algorithm,

We need to meet one important point in programming languages.





© Web Development Company Conkurent, LLC 2008-2009. All rights reserved.