date format?

Various mods to change or add features.

date format?

Postby psyblast » 2004-07-26 06:03 pm

how would I change the format of the date thats posted in the reviews?

http://www.pokemontop500.com/index.php?a=stats&id=1

I want the date format to be changed from 2004-07-26, to July, 07 2004.

Thanks in advance.
psyblast
Advanced Member
 
Posts: 64
Joined: 2004-02-23 12:16 am

Postby Jeremy » 2004-07-26 06:49 pm

fyi, yyyy-mm-dd is the international standard date format and is the most readable of all formats.

if you don't care about that, find these lines in stats.php:
Code: Select all
$query = "SELECT review_id,  review_date, review FROM ".$CONFIG['sql_prefix']."_reviews WHERE id3 = ".$FORM['id'];
if ($FORM['allreviews']) { $result = $db->Execute($query); }
else { $result = $db->SelectLimit($query, 10, 0); }
while (list($review_id, $review_date, $review) = $db->FetchArray($result)) {

change them to this:
Code: Select all
$query = "SELECT review_id,  TIMESTAMP('review_date'), review FROM ".$CONFIG['sql_prefix']."_reviews WHERE id3 = ".$FORM['id'];
if ($FORM['allreviews']) { $result = $db->Execute($query); }
else { $result = $db->SelectLimit($query, 10, 0); }
while (list($review_id, $review_date, $review) = $db->FetchArray($result)) {
  $review_date = date('F j, Y, g:i a', $review_date);

http://us3.php.net/date has more info on the date() function so you can custimize the date format.

also, i would appreciate it if you linked back to my site at the bottom, considering this is a free script and you are getting free support.
Jeremy
Supreme Diety
 
Posts: 8922
Joined: 2003-05-05 04:41 pm
Location: NJ, USA

Postby psyblast » 2004-07-26 06:55 pm

oh yeah I'm using 4.1.1 so that code isint in the stats.php >_<
psyblast
Advanced Member
 
Posts: 64
Joined: 2004-02-23 12:16 am

Postby Jeremy » 2004-07-26 08:19 pm

yes it is.
Jeremy
Supreme Diety
 
Posts: 8922
Joined: 2003-05-05 04:41 pm
Location: NJ, USA

Postby psyblast » 2004-07-26 09:38 pm

sorry about that i missread what you wrote, i thought that was one bunch of code i needed to replace *dumb*

getting this error

You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '('review_date'), review FROM pt5_reviews WHERE id3 = 112 LIMIT


MySQL version 4.0.20-standard

heres the line exactly as its uploaded to the server
$query = "SELECT review_id, author, TIMESTAMP('review_date'), review FROM ".$CONFIG['sql_prefix']."_reviews WHERE id3 = ".$FORM['id'];
psyblast
Advanced Member
 
Posts: 64
Joined: 2004-02-23 12:16 am

Postby Jeremy » 2004-07-26 10:03 pm

try this...

change that line back to what it originally was. then add this before the date() line:
Code: Select all
$review_date = strtotime($review_date);

maybe that will work.
Jeremy
Supreme Diety
 
Posts: 8922
Joined: 2003-05-05 04:41 pm
Location: NJ, USA

Postby psyblast » 2004-07-26 10:15 pm

Code: Select all
$query = "SELECT review_id, author, review_date, review FROM ".$CONFIG['sql_prefix']."_reviews WHERE id3 = ".$FORM['id'];
if ($FORM['allreviews']) { $result = $db->Execute($query); }
else { $result = $db->SelectLimit($query, 10, 0); }
while (list($review_id, $author, $review_date, $review) = $db->FetchArray($result)) {
$review_date = strtotime($review_date);


I dont see any date line to add that code before, so here the code I have in there

Heres what I'm getting for the date
1090818000
psyblast
Advanced Member
 
Posts: 64
Joined: 2004-02-23 12:16 am

Postby Jeremy » 2004-07-27 12:32 am

yea, u need this after that:
Code: Select all
  $review_date = date('F j, Y, g:i a', $review_date);
Jeremy
Supreme Diety
 
Posts: 8922
Joined: 2003-05-05 04:41 pm
Location: NJ, USA

Postby psyblast » 2004-07-27 05:21 pm

working great now Jeremy, thank you for the support. :)

BTW the link to your site is workin again, i had it linked, but i must of overwrote the file and didnt notice it wasnt linked, sorry about that
psyblast
Advanced Member
 
Posts: 64
Joined: 2004-02-23 12:16 am


Return to Mods

Who is online

Users browsing this forum: No registered users and 0 guests

cron