Thread View: pl.comp.lang.python
5 messages
5 total messages
Started by ammate
Fri, 22 Nov 2013 10:48
Różnica podczas dekodowania daty z php
Author: ammate
Date: Fri, 22 Nov 2013 10:48
Date: Fri, 22 Nov 2013 10:48
14 lines
1570 bytes
1570 bytes
W php mam taki kawałek kodu:
$gpxTime = date('Y-m-d H:i:s', 1355295480);
echo ' Data: '.$gpxTime.'<br />';
Który zwraca: 2012-12-12 12:28:00
A w python:
datetime.fromtimestamp(1355295480).strftime('%Y-%m-%d %H:%m:%S')
Zwraca:
'2012-12-12 07:12:00'
Czy ktoś może wskazać, gdzie jest błąd?
Re: Różnica podczas dekodowania daty z php
Author: Piotr Kęplicz
Date: Fri, 22 Nov 2013 11:07
Date: Fri, 22 Nov 2013 11:07
9 lines
1249 bytes
1249 bytes
ammate@gmail.com:
> datetime.fromtimestamp(1355295480).strftime('%Y-%m-%d %H:%m:%S')
>
> Zwraca:
> '2012-12-12 07:12:00'
%m to miesiąc, %M to minuty.
.pk.
Re: Różnica podczas dekodowania daty z php
Author: Stachu 'Dozzie' K.
Date: Fri, 22 Nov 2013 11:16
Date: Fri, 22 Nov 2013 11:16
25 lines
1796 bytes
1796 bytes
On 2013-11-22, ammate@gmail.com <ammate@gmail.com> wrote:
> W php mam taki kawałek kodu:
>
> $gpxTime = date('Y-m-d H:i:s', 1355295480);
> echo ' Data: '.$gpxTime.'<br />';
>
> Który zwraca: 2012-12-12 12:28:00
>
> A w python:
> datetime.fromtimestamp(1355295480).strftime('%Y-%m-%d %H:%m:%S')
>
> Zwraca:
> '2012-12-12 07:12:00'
>
> Czy ktoś może wskazać, gdzie jest błąd?
W kodzie pisanym w PHP.
#v+
[dozzie@uw000444 dozzie]$ date -d @1355295480 --rfc-2822
Wed, 12 Dec 2012 07:58:00 +0100
#v-
--
Secunia non olet.
Stanislaw Klekot
Re: Różnica podczas dekodowania daty z php
Author: ammate
Date: Fri, 22 Nov 2013 11:18
Date: Fri, 22 Nov 2013 11:18
18 lines
1936 bytes
1936 bytes
On Friday, November 22, 2013 12:07:38 PM UTC+1, Piotr Kęplicz wrote:
> ammate@gmail.com:
>
> > datetime.fromtimestamp(1355295480).strftime('%Y-%m-%d %H:%m:%S')
>
> >
>
> > Zwraca:
>
> > '2012-12-12 07:12:00'
>
>
>
> %m to miesiąc, %M to minuty.
Drobne przeoczenie ale dalej jest różnica:
datetime.fromtimestamp(1355295480).strftime('%Y-%m-%d %H:%M:%S')
'2012-12-12 07:58:00'
Re: Różnica podczas dekodowania daty z php
Author: Roman Dobosz
Date: Thu, 28 Nov 2013 18:40
Date: Thu, 28 Nov 2013 18:40
30 lines
2491 bytes
2491 bytes
On Fri, 22 Nov 2013 03:18:01 -0800 (PST)
ammate@gmail.com wrote:
> > %m to miesiąc, %M to minuty.
>
> Drobne przeoczenie ale dalej jest różnica:
> datetime.fromtimestamp(1355295480).strftime('%Y-%m-%d %H:%M:%S')
> '2012-12-12 07:58:00'
Tak. Stachu wskazał paluchem gdzie jest błąd:
$ php -a
Interactive shell
php > echo "\n".date('Y-m-d H:i:s', 1355295480) . "\n";
PHP Warning: date(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected the timezone 'UTC' for now, but please set date.timezone to select your timezone. in php shell code on line 1
Warning: date(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected the timezone 'UTC' for now, but please set date.timezone to select your timezone. in php shell code on line 1
2012-12-12 06:58:00
php > date_default_timezone_set('CET');
php > echo "\n".date('Y-m-d H:i:s', 1355295480) . "\n";
2012-12-12 07:58:00
php >
--
-^- _ coś tam w tle sobie gra, np:
_ /O)_\// Front Line Assembly - Barcode (Re-Assembled Mix)
(_(|__(_(_) grf.
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads