Re: Problems of conversion with strftime()
| From: | Yasuo Ohgaki | Date: | Wed, 28 Mar 2001 17:33:16 +0000 |
| Subject: | Re: Problems of conversion with strftime() | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-45934@lists.php.net to get a copy of this message | ||
Optional 2nd param for date() and strftime() is UNIX timestamp (i.e. integer -
seconds from epoch)
So I suppose all works as it should.
--
Yasuo Ohgaki
"Evelio Martinez" <evelio.martinez@testanet.com> wrote in message
news:3AC2132D.5074EED9@testanet.com...
> <?
> setlocale("LC_ALL","es_ES");
> $fecha = date("d-m-Y");
> print $fecha ."
> <br>"; ->
> 28-03-2001 ok
> $fecha = "2001-03-28 18:22:00";
> print (date("d m Y H:i:s",$fecha)) ."<br>"; ->01 01
> 1970
> 01:33:21 wrong
> print (date("Y m d H:i:s",$fecha)) ."<br>"; ->1970
> 01 01
> 01:33:21 wrong
> print (strftime("%d-%m-%Y %T")) ."<br>"; ->28-03-2001
> 18:22:24 ok
> print (strftime("%d-%m-%Y %T",$fecha)) ."<br>"; -> 01-01-1970
> 01:33:21
> wrong
>
> ?>
>
>
> Who should I convert between date values?
>
> I am using postgresql date fields and the only way to format de date is
> using the SQL functions
> instead of formating with PHP functions.
>
> select to_char(date(pg_user.valuntil),'DD-MM-YYYY HH24:MI:SS') ...
>
> Any idea?
>
> Thanks in advance
>
> --
> Evelio Martínez
>
>
>