If I have a date that looks like: 2005-12-07 10:10:00
How could I manipulate it in php to say "Dec, 07, 2005"?
I can separate the string at the space, but don't know where to go from
there....thanks for any suggestions. 5 2755
*** Greg Scharlemann escribió/wrote (7 Dec 2005 17:46:43 -0800): If I have a date that looks like: 2005-12-07 10:10:00
How could I manipulate it in php to say "Dec, 07, 2005"?
I think it easier to just get the date in unix timestamp format rather than
a string. Afterwards, you can use several PHP date functions to display it,
such as date() or strftime().
I suppose it comes from a MySQL query so try this:
SELECT UNIX_TIMESTAMP(date_field) FROM table
--
-+ Álvaro G. Vicario - Burgos, Spain
++ http://bits.demogracia.com es mi sitio para programadores web
+- http://www.demogracia.com es mi web de humor libre de cloro
--
Greg Scharlemann wrote: If I have a date that looks like: 2005-12-07 10:10:00
How could I manipulate it in php to say "Dec, 07, 2005"?
I can separate the string at the space, but don't know where to go from there....thanks for any suggestions.
Here's a method I've used (found it using Google a year or so ago):
$a = '2005-12-07';
$y = $a[0].$a[1].$a[2].$a[3];
$m = $a[5].$a[6];
$d = $a[8].$a[9];
$unixtimestamp = mktime(0, 0, 0, $m, $d, $y);
$display_date = date('F j, Y',$unixtimestamp)
--
*****************************
Chuck Anderson • Boulder, CO http://www.CycleTourist.com
Integrity is obvious.
The lack of it is common.
*****************************
Greg Scharlemann wrote: If I have a date that looks like: 2005-12-07 10:10:00
How could I manipulate it in php to say "Dec, 07, 2005"?
I can separate the string at the space, but don't know where to go from there....thanks for any suggestions.
$unixTimestamp = strtotime ("2005-12-07 10:10:00") ;
echo date("M, d, Y", $unixTimestamp);
Greg Scharlemann wrote: If I have a date that looks like: 2005-12-07 10:10:00
How could I manipulate it in php to say "Dec, 07, 2005"?
echo date('M d, Y', strtotime('2005-12-07 10:10:00'));
Cheers,
NC This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Kyle Ramsey |
last post by:
I would like to construct a script that parses and prints the metadata
from a PDF file. This would include the creation date, author, etc.
These attributes are listed in the "document properties"...
|
by: Paul |
last post by:
This method:
static void swap(int a, int b) {
int c = a;
a = b;
b = c;
}
does not swap the values of a and b over. It doesn't work for String
variables either. However the following method...
|
by: Isaac Rodriguez |
last post by:
Does anyone know of a Python API to manipulate CAB files?
Thanks,
--
Isaac Rodriguez
SWE Autodesk.
========================================
There are 10 types of people.
Those who...
|
by: R Reyes |
last post by:
Hi, what is the best way to manipulate MSOffice programs? i understand that
regular web pages do not have the permissions (because of safety measures) to
open up MS word/excel programs, for...
|
by: Stewart |
last post by:
Dear comp.lang.javascript,
I have more than once wanted to manipulate the contents of select boxes
dynamically, whilst the boxes contain <optgroup> tags.
Manipulation of a select box containing...
|
by: Andreas Palm |
last post by:
I have the problem that when I write XML from a dataset I get certain
columns that are empty not as empty elements, rather not at all. To
avoid that I thought I can go to the dataset and easily...
|
by: Chris |
last post by:
Hi,
I am using:
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9,
lcQueryName, strFilePathNamE, True
....to export my query data to an existing excel workbook. Then what i
need...
|
by: Jeff |
last post by:
Can I manipulate the properties of pure HTML controls (i.e. not server side
controls) from my aspx.cs Page_Load event? If so, I don't see the control
listed by intellisense. I gave the control a...
|
by: jayanthigk2004 |
last post by:
Folks,
I need a working code to do the following or something similar.
I have two icons in the screen. One to indicate right (a tick mark) and
one to indicate wrong (a cross).
If the user...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
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: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
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...
| |