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? Link to comment https://forums.phpfreaks.com/topic/33815-deleting-a-record-based-on-the-system-date-time/ 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] Link to comment https://forums.phpfreaks.com/topic/33815-deleting-a-record-based-on-the-system-date-time/#findComment-158618 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] Link to comment https://forums.phpfreaks.com/topic/33815-deleting-a-record-based-on-the-system-date-time/#findComment-158692 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.