Coupon expiration date
I recently did a little project to display a coupon with an expiration date that was calculated. It just adds 21 days to today's date and prints it on the coupon. Here is what the code looks like:
<?php
$nextWeek = time() + (21 * 24 * 60 * 60); //21 days
echo '<p align="center"><font face="Arial, Helvetica, sans-serif">Coupon expires ' ;
echo date('Y-m-d', $nextWeek) ;
echo '</font></p>';
?>It outputs:
Coupon expires: 2008-02-08
Because it adds 21 days to todays date, your output date will be different. I just put this in a story and set the input format to php code.
| Attachment | Size |
|---|---|
| drupaltip1.txt | 650 bytes |
