Current location: Hot Scripts Forums » Programming Languages » PHP » count date


count date

Reply
  #1 (permalink)  
Old 06-28-03, 10:19 PM
superman's Avatar
superman superman is offline
Newbie Coder
 
Join Date: Jun 2003
Posts: 59
Thanks: 0
Thanked 0 Times in 0 Posts
count date

How to count the date from one period to one period. For example, 12-MAY-2003 to 4-Jun-2003, what language should I use and how?
Thank you for your help.
Reply With Quote
  #2 (permalink)  
Old 06-28-03, 10:30 PM
BdSBB BdSBB is offline
Newbie Coder
 
Join Date: Jun 2003
Location: Georgetown, TX
Posts: 54
Thanks: 0
Thanked 0 Times in 0 Posts
PHP Code:

# The first strtotime() is the most current date

# The second strtotime() is the past date
$old  floor((strtotime('4-Jun-2003') - strtotime('12-May-2003')) / 86400); # The days counted from 4-Jun-2003 to 12-May-2003 
strtotime
__________________
-- BdSBB

Last edited by BdSBB; 06-28-03 at 10:32 PM.
Reply With Quote
  #3 (permalink)  
Old 06-28-03, 10:40 PM
superman's Avatar
superman superman is offline
Newbie Coder
 
Join Date: Jun 2003
Posts: 59
Thanks: 0
Thanked 0 Times in 0 Posts
I use oracle as my back-end database, can I just copy this code into the php?
Reply With Quote
  #4 (permalink)  
Old 06-28-03, 10:44 PM
BdSBB BdSBB is offline
Newbie Coder
 
Join Date: Jun 2003
Location: Georgetown, TX
Posts: 54
Thanks: 0
Thanked 0 Times in 0 Posts
Not sure if I know what your saying but yes you can copy this code into the PHP.

A little bit more info on what it's doing. strtotime is turning that date into unix timestamp. And if you want how many days between now and a past date then the first strtotime would be replaced with time().
__________________
-- BdSBB
Reply With Quote
  #5 (permalink)  
Old 06-28-03, 10:45 PM
Ryan's Avatar
Ryan Ryan is offline
Coding Addict
 
Join Date: May 2003
Location: Virginia
Posts: 391
Thanks: 0
Thanked 8 Times in 3 Posts
Oracle is a database system, this is just plain PHP. If you want to store that information in a database then you'll have to figure out the Oracle connection parameters and such.
__________________
Ryan Huff
iNET Interactive, LLC

http://www.inetinteractive.com
Reply With Quote
  #6 (permalink)  
Old 07-01-03, 02:28 AM
superman's Avatar
superman superman is offline
Newbie Coder
 
Join Date: Jun 2003
Posts: 59
Thanks: 0
Thanked 0 Times in 0 Posts
Then how about excluding the saturday and sunday, it is only count from monday to friday only.
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

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
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Post count, why? rob2132 Hot Scripts Forum Questions, Suggestions and Feedback 7 10-06-03 03:29 PM
Date From Access 2000 Database Kaikki ASP 4 09-25-03 06:04 PM
Header date Agent PHP 7 07-20-03 09:31 AM
selection of dup recs by latest date atworx Hot Scripts Forum Questions, Suggestions and Feedback 0 06-24-03 11:05 PM
Days left to certain date. Data from MySQL alfreds PHP 4 06-17-03 09:26 AM


All times are GMT -5. The time now is 08:46 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.