Click to See Complete Forum and Search --> : Count the days since .... DateDiff


CherryAA
10-29-2003, 07:53 AM
With advance apologies - I'm a newbie! This is probably very easy ..... I want this Excel formula:

DaysNumber=DATEDIF("03-Sept-2003",NOW(),"d")

It gives me the number of days that have elapsed since the 3rd September. I've tried all permutations of DATEDIFF that I can think of, but I'm doing something horribly wrong! :confused:

PLEASE can somebody help????!!!!

Thanks
Cherry

gizmo
10-29-2003, 10:04 AM
This is an HTML forum, you're not likely to get an answer here.:eek:

CherryAA
10-29-2003, 10:15 AM
.... now I feel even more stupid!

Er, what language should I be looking at to put a calculated field into an HTML page?

[Cringing with embarrassement]

C

gizmo
10-29-2003, 10:22 AM
A mistake is a sign that someone has tried to do something. Keep trying, I think a PHP script could do what you are after. I am a PHP newbie, but will have a go myself, give me a few hours. :D
gizmo

gizmo
10-29-2003, 10:44 AM
CherryAA, have a look at http://www.php.net/manual/en/ref.datetime.php while you are waiting...:D

CherryAA
10-29-2003, 10:51 AM
Originally posted by gizmo
A mistake is a sign that someone has tried to do something. Keep trying,:D

That's a really nice thing to say! Thanks :)

Am checking your link now ......

Cx

pyro
10-29-2003, 11:09 AM
You can try something like this:

<?PHP
$today = time();
$date = "09-03-2003";
list ($month, $day, $year) = preg_split("/[\\/-]/", $date);
$date= mktime (0,0,0,$month,$day,$year);
$diff = floor(($today - $date)/60/60/24);
echo "$diff days different";
?>

CherryAA
10-29-2003, 12:24 PM
Grrr, how annoying. That looks like it should work, but it just disappeared on my page. Maybe I need to wrap it up more ... I'll try again later!

Thank you both for your help & tolerance!

C :)

pyro
10-29-2003, 12:29 PM
Does your server support PHP?

PeOfEo
10-29-2003, 09:17 PM
I can whip something up in asp.net if your server happens to support that :) But asp.net hosting is not as common and you would probably know if your host supported it :rolleyes:

CherryAA
11-28-2003, 08:36 AM
... for all the replies!

I still don't know why Pyro's script didn't work, but I eventually found a javascript in the javascript Source :rolleyes: that was easily modified to return days. It's still counting.

Cheers :)

wmbs
12-07-2003, 01:54 PM
I use a JS script by Alan Palmer to count days since a date in the past and days until a date in the future. You can see the code in action at http://hammerlogic.com

PeOfEo
12-07-2003, 05:43 PM
The poem about this forum I am making up on the fly
and then another thread
came back from the dead