Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.php > #6991

Re: how format one date

Path csiph.com!usenet.pasdenom.info!news.albasani.net!news.musoftware.de!wum.musoftware.de!news.mind.de!bolzen.all.de!npeer.de.kpn-eurorings.net!npeer-ng0.de.kpn-eurorings.net!newsfeed.arcor.de!newsspool4.arcor-online.net!news.arcor.de.POSTED!not-for-mail
Content-Type text/plain; charset="UTF-8"
Message-ID <3740232.YjNHZVqIbo@PointedEars.de> (permalink)
From Thomas 'PointedEars' Lahn <PointedEars@web.de>
Reply-To Thomas 'PointedEars' Lahn <php@PointedEars.de>
Organization PointedEars Software (PES)
Date Sat, 08 Sep 2012 00:22:37 +0200
User-Agent KNode/4.4.11
Content-Transfer-Encoding 8Bit
X-Face %i>XG-yXR'\"2P/C_aO%~;2o~?g0pPKmbOw^=NT`tprDEf++D.m7"}HW6.#=U:?2GGctkL,f89@H46O$ASoW&?s}.k+&.<b';Md8`dH6iqhT)6C^.Px|[=M@7=Ik[_w<%n1Up"LPQNu2m8|L!/3iby{-]A+#YE}Kl{Cw$\U!kD%K}\2jz"QQP6Uqr],./"?;=4v
Face iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAGFBMVEXTxa4RFk5dUWANED8PFEfy7+MGBiW+n3ZNF/QuAAACaElEQVQ4jVXUwVOcMBQG8Dc7Rc4PUntdWV2uxjDpGaGeozOp1woar4jd5t/v9wLstMwsA/ntlxdCAgUc1hjTc9/JCZfGoo3wG3HdmdAWrIJRHe7GM/TmpY5VFefuVcAkkPbLIaN8rmPmjloyZxgyR3GuJ4K0AGtJ2htz8o7yqikm759fldQXaMpbDzjKAG+8v+AugVTOPO5DOjLvGtUYQwh0CPjnVMyGd+8/GfUB5nLKJDD2aLDh5HYyMDJGDwQIo2ZmZcKbowNmAdB/AzyFhrmF2MHRb0QJJfaAnwGB6orZhoykLzJtGwF/xpYxI1dswomiUj3gTuAIqCn/4C7cULwGNBtwMTk3Y4LfKB5YUaOKBKYtpplm7u0vip8tU1NWWyI/7XdcSuIDoMt6rVHMWT0DbjHPGqDqZVSa6zleLcUTcIKLoMv3ueJluALtAo9B302zPPlrtiVScRdCjXvVh3e3JpYa/jjkuC9N+LrBMlz/eAN4eQijX2EdLo6c5tGGHwLyHFtXk89dDGHwCVhG9T0S/j55AhRZgkMCmUQXJ49TnS1wnQDvw0eAh9ICeMmEFbCnPMFzjAvsWoEWEFdYEx+S0MoUZ1gT1wId8+AF3Bl2OoEu906AUHx5VLw/gXYg/x84loOah/2UYNrgiwSwGO7RfUzVBbx/kgpckumGOi6QirtD6gkLTitbnxNol47S2jVc2vsN5kPqaAHT8uUdAJM4v/DanjYOwmUjWznGfwB7sGtAtor5BgofDuzaRj4kSQAqDakTsKORa3Q3xKi3gE1fhl71KRMqrdZ2AWNNg/YOhQyrVBnb+i+nEg4bsDA+egAAAABJRU5ErkJggg==
Subject Re: how format one date
Newsgroups comp.lang.php
References <167rucpmv69q.h70u289ic3i6$.dlg@40tude.net> <k2ctvd$3191$1@yojimbo.hack> <1guuas2go7c0i$.1aviei1ybpcod$.dlg@40tude.net> <timstreater-7DBA59.19074607092012@news.individual.net> <k2dhtd$t7k$1@speranza.aioe.org> <1584824.OSQIn9VdOr@PointedEars.de>
Followup-To comp.lang.php
MIME-Version 1.0
Lines 52
NNTP-Posting-Date 08 Sep 2012 00:22:38 CEST
NNTP-Posting-Host 8839dd37.newsspool1.arcor-online.net
X-Trace DXC=_T1cW]R8EgR1`E>oC;JXEZic==]BZ:af^4Fo<]lROoRQnkgeX?EC@@PIRTKiQcV`1TDZm8W4\YJN\R=i2=[N6Y6Z4^f?YmnoooTQOXQGXPfA0P
X-Complaints-To usenet-abuse@arcor.de
Xref csiph.com comp.lang.php:6991

Followups directed to: comp.lang.php

Show key headers only | View raw


Thomas 'PointedEars' Lahn wrote:

> bill wrote:
>> On 9/7/2012 2:07 PM, Tim Streater wrote:
>>> In article <1guuas2go7c0i$.1aviei1ybpcod$.dlg@40tude.net>,
>>> nawfer <novalidsforspam@alt.al> wrote:
>>>> Il Fri, 7 Sep 2012 13:48:29 +0000 (UTC), Salvatore ha scritto:
>>>> > On 2012-09-07, nawfer <novalidsforspam@alt.al> wrote:
>>>> >> if have one of this date so
>>>> >>
>>>> >> Thu, 06/09/2012 - 23:50
>>>> >> Thursday, 6 September, 2012 - 23:50
>>>> >> Thu, 06/09/2012 - 23:50
>>>> >> 06/09/2012 - 23:50
>>>> >>
>>>> >> how can have this >> 2012-09-06T23:50:00
>>>> >>
>>>> >> and finally to have the seconds 1346968200
>>>> > > I'm not sure if you're asking how to *format* a date or how
>>>> > > to *parse* a date. If you want to format a date, given a
>>>> > > timestamp, use either the date() function or the strftime()
>>>> > > function. If you want to parse a date, given a string, use
>>>> > > either the strtotime() function or the strptime()
>>>> > > function.
>>>>
>>>> if have this string
>>>> "06/09/2012 - 23:50"
>>>
>>> Use strtotime () to convert the above into seconds.
>> then use date() to convert it back to the format you want.
> 
> In this case, strptime() and strftime() should be used instead because, in
> contrast to strtotime() and date(), they observe the current locale (note
> the German month name above),

OK, bad example.  It's not German here, for the weekday is in English.  But 
you see my point:

> and you get to choose the supported format with strptime(), so there are
> no ambiguities with parsing. […]
> That is, if, and only if, the hyphen is removed before; else it returns 
> FALSE because that is not one of the formats supported by it.  Tested
  ^^^^^
> with PHP 5.3.10-1 (cli) (built: Feb  3 2012 10:03:01).


PointedEars
-- 
> If you get a bunch of authors […] that state the same "best practices"
> in any programming language, then you can bet who is wrong or right...
Not with javascript. Nonsense propagates like wildfire in this field.
  -- Richard Cornford, comp.lang.javascript, 2011-11-14

Back to comp.lang.php | Previous | Next — Previous in thread | Find similar | Unroll thread


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