Welcome to Dream.In.Code
Getting PHP Help is Easy!

Join 132,602 PHP Programmers for FREE! Get instant access to thousands of PHP experts, tutorials, code snippets, and more! There are 945 people online right now. Registration is fast and FREE... Join Now!




Dates

 
Reply to this topicStart new topic

Dates

capty99
post 3 Nov, 2002 - 09:18 PM
Post #1


the real kya

Group Icon
Joined: 26 Apr, 2001
Posts: 9,137



Thanked 15 times

Dream Kudos: 550
My Contributions


if i got my blog how do i organize the older rants by months?

ya know, everyone does it.
so i would have a link where it would be for october 2000
and no matter how many i posted that month they would all display
User is offlineProfile CardPM

Go to the top of the page

fyrestorm
post 4 Nov, 2002 - 10:20 AM
Post #2


D.I.C Lover

Group Icon
Joined: 4 Apr, 2002
Posts: 3,103



Thanked 2 times

Dream Kudos: 228
My Contributions


is this like a blogger you personally made or is it something that you're using a site online or what?
User is offlineProfile CardPM

Go to the top of the page

capty99
post 4 Nov, 2002 - 10:29 AM
Post #3


the real kya

Group Icon
Joined: 26 Apr, 2001
Posts: 9,137



Thanked 15 times

Dream Kudos: 550
My Contributions


i made it.
simple form.
updates to db
and a page displays the last 10 entries or something
User is offlineProfile CardPM

Go to the top of the page

fyrestorm
post 4 Nov, 2002 - 10:39 AM
Post #4


D.I.C Lover

Group Icon
Joined: 4 Apr, 2002
Posts: 3,103



Thanked 2 times

Dream Kudos: 228
My Contributions


so do you have an actual date field in your table?
User is offlineProfile CardPM

Go to the top of the page

capty99
post 5 Nov, 2002 - 05:08 PM
Post #5


the real kya

Group Icon
Joined: 26 Apr, 2001
Posts: 9,137



Thanked 15 times

Dream Kudos: 550
My Contributions


si senor, timestamp
User is offlineProfile CardPM

Go to the top of the page

Spider
post 8 Nov, 2002 - 07:54 AM
Post #6


Arachnid

****
Joined: 10 Jul, 2002
Posts: 769


My Contributions


in that case your best bet is to extract the timestamp and explode() it, then compare the year and month bits.
User is offlineProfile CardPM

Go to the top of the page

MathewS
post 8 Nov, 2002 - 01:25 PM
Post #7


D.I.C Regular

***
Joined: 14 May, 2002
Posts: 252



Thanked 1 times

Dream Kudos: 1
My Contributions


if it a mysql timestamp then you could use this function to display the date
CODE

function time_format($timestamp)
{
   $hour = substr($timestamp,8,2);  
   $minute = substr($timestamp,10,2);  
   $second = substr($timestamp,12,2);  
   $month = substr($timestamp,4,2);  
   $day = substr($timestamp,6,2);  
   $year = substr($timestamp,0,4);  
   $mktime = mktime($hour, $minute, $second, $month, $day, $year);  
   $formated = date("F j, Y, g:i a",$mktime);
   return $formated;
}


so you just use something like this to select it all
CODE

//querystring
$month = 12; // DECEMEBER
$year = 2000;

//old rant
if ($month==01) {
$month = 00;
} else if ($month<10) {
$month = "0$month";
}

$date_prev = "$year".($month - 1)."00000000";
$date_next = "$year".($month + 1)."00000000";
$result = mysql_query("SELECT * FROM blog WHERE date<'".$date_next."' AND date>'".$date_prev."' ORDER BY date DESC");
while ($blogresult = mysql_fetch_array($result)) {

//echo all stuff in here

}
User is offlineProfile CardPM

Go to the top of the page

Fast ReplyReply to this topicStart new topic
Time is now: 11/23/08 02:13AM

Live PHP Help!

PHP Tutorials

Reference Sheets

PHP Snippets

Bye Bye Ads

Free DIC T-Shirt

T-Shirt Example

Related Sites

Monthly Drawing

Thumb Drive

Partners

Top Contributors

Top 10 Kudos This Month