Skip to content

Instantly share code, notes, and snippets.

@saltun
Created June 12, 2016 22:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save saltun/0ea2b633c5f6444a6b332cc87b088f70 to your computer and use it in GitHub Desktop.
Save saltun/0ea2b633c5f6444a6b332cc87b088f70 to your computer and use it in GitHub Desktop.
PHP Create Random Date
<?php
/**
* @author Savaş Can ALTUn <savascanaltun@gmail.com>
* www.savascanaltun.com.tr
*/
$tarihBas = strtotime('1.1.2016'); // date Start
$tarihSon = strtotime('24.06.2016'); // date End
$rastgeleTarih = rand($tarihBas, $tarihSon); // create random
echo(date('d.m.Y H:i', $rastgeleTarih)); // convert time
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment