Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.php > #6984
| Path | csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.glorb.com!news.enother.com!newsfeed.hal-mli.net!feeder1.hal-mli.net!yojimbo.hack!news.tokachu.com!.POSTED!not-for-mail |
|---|---|
| From | Salvatore <sal@yojimbo.hack.invalid> |
| Newsgroups | comp.lang.php |
| Subject | Re: how format one date |
| Date | Fri, 7 Sep 2012 15:10:49 +0000 (UTC) |
| Organization | Yojimbo NNTP server |
| Lines | 24 |
| Message-ID | <k2d2pp$2o1$1@yojimbo.hack> (permalink) |
| References | <167rucpmv69q.h70u289ic3i6$.dlg@40tude.net> <k2ctvd$3191$1@yojimbo.hack> <1guuas2go7c0i$.1aviei1ybpcod$.dlg@40tude.net> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=us-ascii |
| Content-Transfer-Encoding | 7bit |
| X-Trace | yojimbo.hack "kq(Iga%czn" |
| X-Complaints-To | usenet(at)tokachu(dot)com |
| User-Agent | slrn/0.9.9p1 (FreeBSD) |
| X-Watermark | "Q(<g$Wn^Dpu?5ybLlS9ORLVybRy&cxqi?uiYX8bm?k`pWb{Es_rzZXO1eCl{" |
| X-Reader-User | hidden; display="24EEr1QzLVIfRpxx65/wVSkg68k" |
| Xref | csiph.com comp.lang.php:6984 |
Show key headers only | View raw
On 2012-09-07, nawfer <novalidsforspam@alt.al> wrote:
> if have this string
> "06/09/2012 - 23:50"
>
> how can have this
> 2012-09-06T23:50:00
Ah! I understand now. What you want to do is parse the European-style
string using strptime().
Here's a code example:
<?php
$formattedDate = '06/09/2012 - 23:50';
define('LOCAL_DATE_FORMAT', '%d/%m/%Y - %R');
// Break apart the date.
$dateArray = strptime($formattedDate, LOCAL_DATE_FORMAT);
$reformattedDate = sprintf('%04d-%02d-%02dT%02d:%02d:00', $dateArray['tm_year'] + 1900, $dateArray['tm_mon'] + 1, $dateArray['tm_mday'], $dateArray['tm_hour'], $dateArray['tm_min']);
?>
--
Blah blah bleh...
GCS/CM d(-)@>-- s+:- !a C++$ UBL++++$ L+$ W+++$ w M++ Y++ b++
Back to comp.lang.php | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
how format one date nawfer <novalidsforspam@alt.al> - 2012-09-07 15:28 +0200
Re: how format one date Salvatore <sal@yojimbo.hack.invalid> - 2012-09-07 13:48 +0000
Re: how format one date nawfer <novalidsforspam@alt.al> - 2012-09-07 16:56 +0200
Re: how format one date Salvatore <sal@yojimbo.hack.invalid> - 2012-09-07 15:10 +0000
Re: how format one date nawfer <novalidsforspam@alt.al> - 2012-09-07 17:20 +0200
Re: how format one date Salvatore <sal@yojimbo.hack.invalid> - 2012-09-07 15:39 +0000
Re: how format one date nawfer <novalidsforspam@alt.al> - 2012-09-13 16:29 +0200
Re: how format one date Luuk <luuk@invalid.lan> - 2012-09-07 22:05 +0200
Re: how format one date Tim Streater <timstreater@greenbee.net> - 2012-09-07 19:07 +0100
Re: how format one date bill <william@TechServSys.com> - 2012-09-07 15:28 -0400
Re: how format one date Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2012-09-08 00:19 +0200
Re: how format one date Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2012-09-08 00:22 +0200
csiph-web