U user-7256 VIP Member VIP โ 20 โ Impact 111 Oct 19, 2005 528 views 5 replies #1 Hi, Let's say I have date format in PHP: $date = date("Y-m-d"); How can I add exactly 1 year to this? Thanks, -Matt
Hi, Let's say I have date format in PHP: $date = date("Y-m-d"); How can I add exactly 1 year to this? Thanks, -Matt
U unknowngiver VIP Member VIP โ 20 โ Impact 19 Oct 19, 2005 #2 i think u can use $date++ [not so sure tho since i m a newbie too]
moondog Established Member โ 20 โ Impact 23 Oct 19, 2005 1 point #3 Can could just do this: $year = date('Y'); $year++; $remainingDate = date('m-d'); $date = "$year-$remainingDate"; -Bob
Can could just do this: $year = date('Y'); $year++; $remainingDate = date('m-d'); $date = "$year-$remainingDate"; -Bob
axilant Account Closed Impact 28 Oct 19, 2005 1 point #4 i told him how over instant message PHP: $date = date("Y-m-d"); $tmp = explode("-", $date); $tmp[0]++; $newdate = "$tmp[0]-$tmp[1]-$tmp[2]";
i told him how over instant message PHP: $date = date("Y-m-d"); $tmp = explode("-", $date); $tmp[0]++; $newdate = "$tmp[0]-$tmp[1]-$tmp[2]";
U user-7256 VIP Member VIP โ 20 โ Impact 111 Oct 19, 2005 #5 Hm, thanks for the way you showed me axilant However, moondog's way is a bit shorter. I'll add to both your reps Thanks both! ^_^
Hm, thanks for the way you showed me axilant However, moondog's way is a bit shorter. I'll add to both your reps Thanks both! ^_^
U unknowngiver VIP Member VIP โ 20 โ Impact 19 Oct 19, 2005 #6 Rep added for axilant..I alwayz got lost wid the explode thing in php...but ur example explains it a lil better :P thanks lol
Rep added for axilant..I alwayz got lost wid the explode thing in php...but ur example explains it a lil better :P thanks lol