Quick tip – how to generate MySQL random date/time in given range?

Just use:

where first param UNIX_TIMESTAMP(‘2012-11-13 16:00:00’) is start value, second UNIX_TIMESTAMP(‘2012-11-13 23:00:00’) is end value, it has to be repeated twice like shown here:

Leave a Reply