LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
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.

Notices


Reply
  Search this Thread
Old 10-19-2006, 04:57 AM   #1
dylan912
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, 05:57 AM   #2
hobey
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.
 
  


Reply



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 08:38 AM
Help needed regarding bandwidth calculation russoue Programming 2 07-13-2005 09:51 AM
Drive space calculation? Redhatusr Linux - Software 2 01-07-2005 01:11 PM
c math calculation alaios Programming 3 06-01-2004 01:46 AM
Load average calculation ? mikeshn Linux - General 4 08-27-2003 02:53 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 06:40 PM.

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