Help answer threads with 0 replies.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
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.


  Search this Thread
Old 02-22-2005, 10:14 PM   #1
Registered: Jun 2004
Location: Wantage, NJ
Distribution: Fedora 7
Posts: 177

Rep: Reputation: 30
Translating output of MySQL -> English

Okay, I have a table called ENTRIES, and to get the date, I'm using the code:

PHP Code:
$result mysql_query("SELECT `TIMEPOSTED` FROM `ENTRIES` WHERE `ID`='".$x."'");
$row mysql_fetch_row($result);
to retrieve the time a blog entry was made. Now, this usually outputs something funky like "2005-02-22 13:15:26"

Can I translate this into "February 2, 2005 1:15 PM" somehow?

And furthermore, If I were to make a query so people could select what month they'd want to see entries from, could I write a good query to find that?
Old 02-23-2005, 12:56 AM   #2
Senior Member
Registered: Jan 2004
Location: Slovenia
Distribution: Slackware 10.1, SLAX to the MAX :)
Posts: 1,040

Rep: Reputation: 45
To translate a date use this:

$timeposted = date("d.m.Y \a\t H:i:s ",strtotime($row[0]));

This will reformat the timestamp variable and make it in any kind you want. See for details on the date function. d=day, m=month, Y=year, H=hour in 24 hour format, and so on. See for details.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Is there English-to-English dictionary in linux? uishen Linux - General 27 06-03-2009 10:36 PM
Way to use a good free English to English Dictionary linbose Linux - Software 6 06-03-2009 10:25 PM
i am looking for a english to english dictionary for RedHat8.0 rddreamz Linux - Software 1 07-10-2004 10:58 AM
Can I have english menu with chinese/english/spanish input? codec Linux - General 9 10-04-2003 07:18 PM
english-english dictionary for linux zozia Linux - Software 4 09-21-2003 02:32 PM > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 11:44 PM.

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