Skip to content
Advertisement

Tag: timestamp

PHP find the days until a date

I have to find the number of days until a date in timestamp format (mysql db) My problem is that if date now is 2013-12-01 09:59:00 the days are 15 while datenow is 2013-12-01 10:01:00 the days are 14. How could I make a difference only of the days without the time? Answer Using the DateTime class: returns

How can I get today’s timestamp in PHP

I tried but when I output it I still get the time eg “22 Jan 2011 4:53:59 pm”. Why is that? UPDATE Ah… many people misunderstood me, my bad, I forgot to point out the main point. I created the date with just the date portion, I don’t want the time. So I’d expect something like Answer You can call

How to generate random date between two dates using php?

I am coding an application where i need to assign random date between two fixed timestamps how i can achieve this using php i’ve searched first but only found the answer for Java not php for example : Answer PHP has the rand() function: It also has mt_rand(), which is generally purported to have better randomness in the results: To

Advertisement