Solarpitch Posted January 11, 2007 Share Posted January 11, 2007 Hey Guys, When a user uploads a file on my site, they choose how many days they would like it to stay online for, then after that period it will be taken down automatically. I am using the following code to calculate the expiry date of the file but it doesnt work. Here's what I have . . . [code]<?php$period = 5; // how many days$expiry_date = date('Y-m-d', strtotime("+$period days"));?>[/code]Any Ideas? Quote Link to comment Share on other sites More sharing options...
trq Posted January 11, 2007 Share Posted January 11, 2007 [code]<?php $period = 5; // how many days $expiry_date = date('Y-m-d', mktime(0, 0, 0, date("m") , date("d")+$period, date("Y")));?>[/code] Quote Link to comment Share on other sites More sharing options...
Draicone Posted January 11, 2007 Share Posted January 11, 2007 Try doing it using the UNIX timestamp.[code]<?php$period = 5;$expiry_date = date('Y-m-d',time()+($period*24*60*60));?>[/code] Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.