redarrow Posted August 26, 2006 Share Posted August 26, 2006 Can somone kindly show me how to show the date left from the below i get a 2 thats wrong lol......advance thank you. [code]<?php$days_left= date("d-m-y",$record['exspire_date']) - date("d-m-y",$record['added_date']);?>added date: 26-08-06 // date formatexspire date: 28-07-07//date formatdays left 2// from above verable[/code]tried this way aswell.[code]<?php$days_left=$record['exspire_date']-$record['added_date'];$days_left=date("d-m-y",$days_left);result but wrong total days left: 03-12-70?>[/code] Link to comment https://forums.phpfreaks.com/topic/18701-solveddate-diffrence/ Share on other sites More sharing options...
redarrow Posted August 26, 2006 Author Share Posted August 26, 2006 sorry i want to cleair the above post up, i need to now how many days there are from now to exspire date in a number format.example you have 400 days left before account exspiredexample but i get a 1[code]<?php$days_left=count(date("d-m-y",$record['exspire_date']));?>[/code] Link to comment https://forums.phpfreaks.com/topic/18701-solveddate-diffrence/#findComment-80638 Share on other sites More sharing options...
Barand Posted August 26, 2006 Share Posted August 26, 2006 If $record['exspire_date'] is held as a timestamp value[code]$seconds = $record['exspire_date'] - time();$days_remaining = floor($seconds / 86400);[/code] Link to comment https://forums.phpfreaks.com/topic/18701-solveddate-diffrence/#findComment-80640 Share on other sites More sharing options...
redarrow Posted August 26, 2006 Author Share Posted August 26, 2006 barand thank you so much. Link to comment https://forums.phpfreaks.com/topic/18701-solveddate-diffrence/#findComment-80646 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.