Never a website you can see in an hour from now? Here s PHP script example and explanation.
Testimony is the time calculations can be done, of course, in many ways. Typically, advanced programmers to create PHP script in a very short time. You know why? One reason is that the PHP script that is efficient and, of course, the shortest PHP script, it seems increasingly sophisticated and more complicated for us beginners.
Well, here we try to step to see.
One way is in three simple steps:
1 Changing the rules timestamply the timestamp server through $ timestamp = strtotime ($ cur).
Well, the contents of variable $ timestamp is the number of seconds since January 1, 1970.
2 If so, timestamp SAI, to add the number of seconds, so (in this case is 60 seconds, add the following line of code. $ timestamp = $ timestamp +60.
3 If you have lived in the amount of the timestamp to format the date as we know, in general, with a date function.
Thus, the entire code:
Code:
$ Timestamp = strtotime ($ cur);
$ Timestamp = $ timestamp +60;
date ("m / d / Y H: i: s", $ timestamp);
?> ?>
It is easy.
Well, of course, other forms are shorter (and perhaps a bit confusing for a new learning), as in the following example:
$ Timestamp = date ('U');
$ Cur = date ('m / d / YH: i: s', $ timestamp);
Next = date ('m / d / YH: i: s', $ timestamp +60);
I hope useful.
Best wishes.
0 comments:
Post a Comment