Random MySQL Dates

Here is a good way to generate a random date that you can use in MySQL.

SELECT FROM_UNIXTIME(RAND() * 2147483648) AS MyDate;

or

INSERT INTO TableName (DateField) VALUES (FROM_UNIXTIME(RAND() * 2147483648));
Leave A Reply
All content licensed under the Creative Commons License