I'm trying keep the date, and trim off the time when I pull it from a
wordpress datebase in a while loop. Here's what I'm doing right now:
$lmdate = mysql_query("SELECT post_modified FROM wp_posts WHERE
post_status = 'publish'");
while ($date = mysql_fetch_array($lmdate, MYSQL_ASSOC)) {
$lm = $date['post_modified'];
echo $lm;
My out put is:
2007-10-03 12:55:19
I'd like the output to be just the date without the time:
2007-10-03
Thanks you,
HG 5 1372
On Jul 22, 12:01 am, toddlah...@gmail.com wrote:
I'm trying keep the date, and trim off the time when I pull it from a
wordpress datebase in a while loop. Here's what I'm doing right now:
$lmdate = mysql_query("SELECT post_modified FROM wp_posts WHERE
post_status = 'publish'");
while ($date = mysql_fetch_array($lmdate, MYSQL_ASSOC)) {
$lm = $date['post_modified'];
echo $lm;
My out put is:
2007-10-03 12:55:19
I'd like the output to be just the date without the time:
2007-10-03
Thanks you,
HG
Take the leftmost 10 characters?
On Jul 22, 12:26 am, MikeB <MPBr...@gmail.comwrote:
On Jul 22, 12:01 am, toddlah...@gmail.com wrote:
I'm trying keep the date, and trim off the time when I pull it from a
wordpress datebase in a while loop. Here's what I'm doing right now:
$lmdate = mysql_query("SELECT post_modified FROM wp_posts WHERE
post_status = 'publish'");
while ($date = mysql_fetch_array($lmdate, MYSQL_ASSOC)) {
$lm = $date['post_modified'];
echo $lm;
My out put is:
2007-10-03 12:55:19
I'd like the output to be just the date without the time:
2007-10-03
Thanks you,
HG
Take the leftmost 10 characters?
should have added this:
Check out http://us3.php.net/manual/en/function.substr.php
Message-ID:
<6c**********************************@j33g2000pri. googlegroups.comfrom to********@gmail.com contained the following:
>My out put is:
2007-10-03 12:55:19
I'd like the output to be just the date without the time:
2007-10-03
I think you need to check out the mySql date formatting functions.
--
Geoff Berrow 0110001001101100010000000110
001101101011011001000110111101100111001011
100110001101101111001011100111010101101011 http://slipperyhill.co.uk
On Jul 22, 10:01*am, toddlah...@gmail.com wrote:
I'm trying keep the date, and trim off the time when I pull it from a
wordpress datebase in a while loop. Here's what I'm doing right now:
$lmdate = mysql_query("SELECT post_modified FROM wp_posts WHERE
post_status = 'publish'");
while ($date = mysql_fetch_array($lmdate, MYSQL_ASSOC)) {
* * * * * * * * $lm = $date['post_modified'];
* * * * echo $lm;
My out put is:
2007-10-03 12:55:19
I'd like the output to be just the date without the time:
2007-10-03
Thanks you,
HG
You can format the date, by using the date() function of php.
like this..
echo date('Y-m-d', strtotime($lm));
It will output like this.. 2007-10-03.
Cheers..!!!
..oO(to********@gmail.com)
>I'm trying keep the date, and trim off the time when I pull it from a wordpress datebase in a while loop. Here's what I'm doing right now:
$lmdate = mysql_query("SELECT post_modified FROM wp_posts WHERE post_status = 'publish'");
while ($date = mysql_fetch_array($lmdate, MYSQL_ASSOC)) { $lm = $date['post_modified'];
echo $lm;
My out put is:
2007-10-03 12:55:19
I'd like the output to be just the date without the time:
2007-10-03
Use MySQL's DATE() function.
Micha This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Rick |
last post by:
I have been trying to run this MySQL query using PHP:
SELECT id, trans_type, remote_addr, DATE_FORMAT(time, '%M %e, %Y %r') as time
FROM transactions WHERE client_id = " . $client_id . " ORDER...
|
by: Johan den Boer |
last post by:
Hi,
What is wrong with this code ?
SELECT DATE_FORMAT( myfield, GET_FORMAT( TIMESTAMP, 'EUR' ) ) FROM T_TABLE;
regards
Johan
|
by: Jimmy |
last post by:
Hi,
I'm new to MySQL and I have qustion regarding to CAST and Date_Format
functions. I'm trying to convert a column 'Time' varchar(50) to
datetime datatype by "select date_format(cast(time as...
|
by: adamalton |
last post by:
I am trying to take a date in the format "YYYY-MM-DD" and get from it the month as a word (e.g. July) and the day as a 2 digit number (e.g. 24).
I am trying to use the date_format function, (new...
|
by: laverdir |
last post by:
<?
$query = "SELECT " . $this->tabela3 . ".id, " . $this->tabela3 .
".naziv, " . $this->tabela3 . ".spisatelj, " . $this->tabela3 .
".najava, " . " DATE_FORMAT(" . $this->tabela3 ....
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
| |