Timestamp Selectbox 15 min intervals


/ Published in: PHP
Save to your folder(s)

Outputs a select box that has timestamps from 12AM-12PM in 15min increments.


Copy this code and paste it in your HTML
  1. <?php
  2. for ($i = 0; $i <= 1440; $i+=15) :
  3. $date = date("g:i A",mktime(0,$i,0,1,1,2000));
  4. ?>
  5. <select>
  6. <option value="<?php echo $date; ?>"><?php echo $date; ?></option>
  7. </select>
  8. <?php
  9. endfor;
  10. ?>

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.