| | |||||
| ||||||||
| Programming PHP, Perl, Ruby on Rails, AJAX, HTML, XHTML, CSS, JavaScript, MySQL and any other coding topics. |
![]() |
| | LinkBack | Thread Tools |
| | THREAD STARTER #1 (permalink) |
| NamePros Regular Join Date: Jan 2006 Location: San Diego, CA
Posts: 734
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() | Generate random timestamp? how can I generate a random timestamp (between now and a few seconds from now / before now) with PHP? PHP Code: What I want to do: Create a random time (in seconds) from now and a few seconds in the future. Just enough time so the banners don't get the same date_last_displayed value in each row. I have searched everywhere for an easy way to do this and most don't explain how to randomize time without treating it as a string. Any help is greatly appreciated. |
| |
| | #3 (permalink) |
| NamePros Member Join Date: May 2007
Posts: 56
![]() | You can convert your timestamp to an integer, and create a random number & add it on to the time. No need to work with strings. Look at the time() function
__________________ Web Design and Internet Services - Oshawa, Ontario |
| |
| | THREAD STARTER #4 (permalink) | ||||
| NamePros Regular Join Date: Jan 2006 Location: San Diego, CA
Posts: 734
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() |
and that seems to work. I just wanted to see how this would be done like the last poster said, by adding an integer. | ||||
| |