- Joined
- Nov 30, 2008
- Messages
- 555 (0.10/day)
- Location
- Birmingham, England...
Processor | Intel Core 2 Quad Q6600 @ 2.8GHz |
---|---|
Motherboard | Gigabyte X48T-DQ6 |
Cooling | Zalman 9500 LED CPU Cooler |
Memory | 2x 2GB Corsair DDR3 XMS3 DHX - 1600MH/PC3-12800 |
Video Card(s) | Gigabyte HD4870 1GB |
Storage | 2x Seagate 320GB Barracuda (RAID 0) 3x 1TB Samsung F3, 140GB WD Maxtor (10,000rpm) |
Display(s) | 2x 20" LG Flatron L204WS |
Power Supply | Powercool 850W |
Software | Windows 7 Ultimate x64 |
Hello
I'm looking for an easy way to extract how many days a table entry has been there, from an SQL db into a PHP website.
For example, when the item is inserted, it gets DATE(2013-05-20). I want my session variable to extract that date, then use the current date to determine how many days it's been there. I was thinking something like:
$_SESSION['age'] = new DateTime(date('Y-m-d')) - ("yyyy/mm/dd") - $dbRecord["age"];
but in the example above, this returns -2012 Days
Thanks for you help
I'm looking for an easy way to extract how many days a table entry has been there, from an SQL db into a PHP website.
For example, when the item is inserted, it gets DATE(2013-05-20). I want my session variable to extract that date, then use the current date to determine how many days it's been there. I was thinking something like:
$_SESSION['age'] = new DateTime(date('Y-m-d')) - ("yyyy/mm/dd") - $dbRecord["age"];
but in the example above, this returns -2012 Days
Thanks for you help