LinuxQuestions.org
Did you know LQ has a Linux Hardware Compatibility List?
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
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.

Notices



Reply
 
Search this Thread
Old 02-22-2005, 11:14 PM   #1
benrose111488
Member
 
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);
$timeposted=$row[0]; 
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, 01:56 AM   #2
marghorp
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 www.php.net for details on the date function. d=day, m=month, Y=year, H=hour in 24 hour format, and so on. See www.php.net for details.
 
  


Reply


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


All times are GMT -5. The time now is 06:04 AM.

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