PHP Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsProgramming LanguagesPHP Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old March 24th, 2000, 03:55 AM
closecut closecut is offline
worshipper of DOT
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2000
Location: Halmstad, Sweden
Posts: 35 closecut User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 5 h 5 m 13 sec
Reputation Power: 14
Send a message via ICQ to closecut
I'm trying to get a month-on-month function for displaying data from a mysql-db.

The table i want to extract info from, stores urls and timestamps.

let's say today is the 15th of march, then i want to display all data timestamped from the 1st of march to the 15th of march, and all data from the 1st of february to the 15th of february.

the dates are stored like "YYYY-MM-DD hh:mm:ss"

i'm lost, totally lost...

can any1 help me?

Reply With Quote
  #2  
Old March 24th, 2000, 07:27 AM
Kyuzo Kyuzo is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 1999
Location: Annapolis, Maryland US
Posts: 113 Kyuzo User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 14
I'm a big fan of MySQL's to_days() function although there are other ways to do it, I'm sure.

// assume timestamp column is called 'stamped'

>SELECT * FROM table_name
>WHERE to_days(stamped) BETWEEN
>(to_days('2000-03-01'))
>AND
>(to_days('2000-03-15'));

// or substitute (to_days(now())); for the last line if today is the upper end of the date limit you want to check.

Check out the online ref manual for information on the to_days() function as well as other date-time arithmetic functions -> very valuable.

Hope this is what you're looking for.

Regards,

Kyuzo

Reply With Quote
  #3  
Old March 24th, 2000, 08:05 AM
closecut closecut is offline
worshipper of DOT
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2000
Location: Halmstad, Sweden
Posts: 35 closecut User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 5 h 5 m 13 sec
Reputation Power: 14
Send a message via ICQ to closecut
it might be of use ...

how does it handle leap years and stuff?

thanks anyway.
/closecut

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesPHP Development > need some help

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap