Jump to content

Archived

This topic is now archived and is closed to further replies.

redarrow

[solved]date diffrence.

Recommended Posts

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 format
exspire date: 28-07-07//date format

days 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]

Share this post


Link to post
Share on other sites
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 exspired

example but i get a 1
[code]
<?php
$days_left=count(date("d-m-y",$record['exspire_date']));
?>
[/code]

Share this post


Link to post
Share on other sites
If $record['exspire_date'] is held as a timestamp value
[code]
$seconds = $record['exspire_date'] - time();

$days_remaining = floor($seconds / 86400);[/code]

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.