Download your favorite Linux distribution at LQ ISO.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


  Search this Thread
Old 10-19-2006, 05:57 AM   #1
LQ Newbie
Registered: Dec 2004
Distribution: Redhat
Posts: 18

Rep: Reputation: 0
Php days calculation

Hi all,

How do I calculate the total days by given a date and to present day. Example

Given date = 10-10-2006
Currant date = 19-10-2006 (this should define automatically)

So total days = 9
If 20-10-2006 it should print 10

This should print total days from the start we enter the date (given date)

Please help
Old 10-19-2006, 06:57 AM   #2
LQ Newbie
Registered: Feb 2006
Distribution: SuSE 10.0
Posts: 17

Rep: Reputation: 0
You could use 'mktime' to get unix timestamps for the two dates. Then compute the difference between the timestamps and you have the seconds between the two dates. Divide by 60*60*24=86400 to get the difference in days.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Clients BandWidth Calculation ahmad82pkn Linux - Networking 0 10-22-2005 09:38 AM
Help needed regarding bandwidth calculation russoue Programming 2 07-13-2005 10:51 AM
Drive space calculation? Redhatusr Linux - Software 2 01-07-2005 02:11 PM
c math calculation alaios Programming 3 06-01-2004 02:46 AM
Load average calculation ? mikeshn Linux - General 4 08-27-2003 03:53 PM > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 04:33 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration