Comparing dates

Dates can be compared only if they are stored in the same format. PHP does not have a variable of type „data”, it must be stored as a timestamp or text. In turn, the form text can be extremely varied, depending on national standards or fantasy programmer – here you can see the advantage timestamp format.


Formatting date

PHP provides several features designed to save the date in your preferred format. Basic to date. Its first argument is a text string that serves as a description of the format. Each letter inserted into this string will be converted to a date element.


Convert date format timestamp

Timestamp other than the current can be achieved in various ways, which must be used according to application.
If there is broken ‘data, that is, in separate variables day, month, year, etc., Or can lead to such a situation by the appropriate use of funkcjiexplode () or substr (), you can use mktime (). This function takes as arguments respectively hour, minute, second, month, day, year.


Getting the current date

The current date can be obtained only in the timestamp format. The date of the returns funkcjatime () task planner. Close-up times can be achieved thanks to the microtime () – data returned by this function are stored a little strange, because string is returned containing separated by a space, respectively microsecond part and seconds, or „msec sec”.



One of the main issues when receiving data from the user to verify their correctness. The checkdate () takes three arguments – respectively, month, day and year, the correctness of which is to be checked. The function returns a Boolean value TRUE if the date is correct task planning.


Processing date

PHP has many features that allow you to process the record date. The primary method of recording the date on Unix and derivatives is tzw.timestamp. This is the number of…

Operations on directories

<?php if ($dir = @opendir ( „/ tmp”)) { while ($file = readdir ($dir)) { echo „$file \ n”; } closedir ($dir); } ?> The second way Example <?php $d…

Processing path

PHP has many features for the analysis and processing of text variables that contain the path to the file. The basename ($ path) returns the name of the file adirname…

Operations on files and directories

To copy a file using a function called copy (). The first parameter is the source file and the second is the destination file or directory. This function returns true if the copy succeeded, or false otherwise. It is good to check whether the copying was successful.


Close Menu