How to generate random date between two dates using php?

前端 未结 13 1913
甜味超标
甜味超标 2020-11-27 15:55

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 a

13条回答
  •  执念已碎
    2020-11-27 16:29

    The best way :

    $timestamp = rand( strtotime("Jan 01 2015"), strtotime("Nov 01 2016") );
    $random_Date = date("d.m.Y", $timestamp );
    

提交回复
热议问题