Skip to content

Instantly share code, notes, and snippets.

@webmayak
Last active February 25, 2019 04:49
Show Gist options
  • Save webmayak/f07f453d0c5101a930344116dc5b4e54 to your computer and use it in GitHub Desktop.
Save webmayak/f07f453d0c5101a930344116dc5b4e54 to your computer and use it in GitHub Desktop.
рандомизировать колонку даты в MySQL
UPDATE `shop_product_reply` SET created = FROM_UNIXTIME(UNIX_TIMESTAMP('2018-09-10 14:53:27') + FLOOR(0 + (RAND() * 86400 * 30 * 5)))
-- '2018-09-10 14:53:27' - дата старта рандомизации
-- 30 - кол-во дней в месяце
-- 5 - кол-во месяцев диапазона рандомизации
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment