# [PHP]: getdate function behaviour

- Thread: https://externals.io/message/41542
- Original archive: https://news-web.php.net/php.internals/41542
- Started by Sanjay Mantoor on 2008-10-29T04:53:11+00:00
- Messages: 4
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #41542 — Sanjay Mantoor — 2008-10-29T04:53:11+00:00

URL: https://externals.io/message/41542#41542

Hello,

While I was working on getdate function, found different behavior with
respect to http://in.php.net/manual/en/function.getdate.php
This is observed only on linux 64bit.
Here is code
<?php
       $timestamp = -12.3456789000e10;
       var_dump( getdate($timestamp) );
?>

As per documentation weekday should be Sunday through Saturday but I
got "Unknown".
Here is the output:
array(11) {
 ["seconds"]=>
 int(20)
 ["minutes"]=>
 int(23)
 ["hours"]=>
 int(5)
 ["mday"]=>
 int(23)
 ["wday"]=>
 int(-4)
 ["mon"]=>
 int(10)
 ["year"]=>
 int(-1943)
 ["yday"]=>
 int(295)
 ["weekday"]=>
 string(7) "Unknown"     ====> It should be Sunday through Saturday
 ["month"]=>
 string(7) "October"
 [0]=>
 int(-123456789000)
}

Can somebody point-out what is the problem? And whether it is an
expected behavior.



--
Thanks,
Sanjay Mantoor

---

## #41545 — Derick Rethans — 2008-10-29T07:42:53+00:00

URL: https://externals.io/message/41542#41545 · In reply to: #41542

> While I was working on getdate function, found different behavior with
> respect to http://in.php.net/manual/en/function.getdate.php
> This is observed only on linux 64bit.
> Here is code
> <?php
>        $timestamp = -12.3456789000e10;
>        var_dump( getdate($timestamp) );
> ?>
> 
> As per documentation weekday should be Sunday through Saturday but I
> got "Unknown".

[snip]

> Can somebody point-out what is the problem? And whether it is an
> expected behavior.

It's a bug in the day-of-week algorithm in case there is a negative 
year. Could you file a bug please?

regards,
Derick

-- 
HEAD before 5_3!: http://tinyurl.com/6d2esb
http://derickrethans.nl | http://ezcomponents.org | http://xdebug.org

---

## #41547 — Sanjay Mantoor — 2008-10-29T08:51:28+00:00

URL: https://externals.io/message/41542#41547 · In reply to: #41545

Derick ,

Yes I will do.

Thanks,
Sanjay M


> 
>
> > […]
>
> [snip]
>
> > […]
>
> It's a bug in the day-of-week algorithm in case there is a negative
> year. Could you file a bug please?
>
> regards,
> Derick
>
> --
> HEAD before 5_3!: http://tinyurl.com/6d2esb
> http://derickrethans.nl | http://ezcomponents.org | http://xdebug.org
>



-- 
Thanks,
Sanjay Mantoor

---

## #41567 — Sanjay Mantoor — 2008-10-30T07:23:20+00:00

URL: https://externals.io/message/41542#41567 · In reply to: #41547

Derick,

I have raised bug
Refer http://bugs.php.net/bug.php?id=46417

Tests related to getdate including test case for the above bug is available at
http://www.4shared.com/file/68976901/6ce81c88/getdate.html.

Please have a look at the tests and use following tests for above bug
       PHP53/getdate_variation7.phpt
       PHP6/getdate_variation7.phpt

Thanks,
Sanjay M

On Wed, Oct 29, 2008 at 2:21 PM, Sanjay Mantoor
<sanjay.mantoor@gmail.com> wrote:
> Derick ,
>
> Yes I will do.
>
> Thanks,
> Sanjay M
>
> 
> > […]
>
>
>
> --
> Thanks,
> Sanjay Mantoor
>



-- 
Thanks,
Sanjay Mantoor
