Jump to content

UNIXTIMESTAMP - Is it always 10 Digit Long


jimmy_B

Recommended Posts

Hi,

mktime returns date in UNIXTIMESTAMP format & it's 10 digit long.


I just want to know that Is UNIXTIMESTAMP is always 10 digit long or it can be less than 10 digits or more than digits in other cases.

Thanks in advance for your consideration :)

Jimmy

Link to comment
Share on other sites

This is strange.

max 32 bits int: 4294967296

max/2 = 2147483648

echo date('j-m-Y', 4294967295); // got error

echo date('j-m-Y', 2147483645);  // 19-01-2038

for any negative $n:
echo date('j-m-Y', $n); // got error
echo date('j-m-Y', -680646);  // error

It look as the unix time went from 0 to 2147483647 which is only half of the range of 32 bits int, with Windows.
I don't understand this.  Perhap anyone can explain?
Link to comment
Share on other sites

[quote author=hvle link=topic=121217.msg498110#msg498110 date=1168086740]
This is strange.

max 32 bits int: 4294967296

max/2 = 2147483648

echo date('j-m-Y', 4294967295); // got error

echo date('j-m-Y', 2147483645);  // 19-01-2038

for any negative $n:
echo date('j-m-Y', $n); // got error
echo date('j-m-Y', -680646);  // error

It look as the unix time went from 0 to 2147483647 which is only half of the range of 32 bits int, with Windows.
I don't understand this.  Perhap anyone can explain?
[/quote]
Maybe it's because it is a signed int? But then why are negative numbers giving an error..?  :-\
Link to comment
Share on other sites

has anybody tried it?
I'm using Windows XP.

[code]<?php

echo date('j-m-Y', -680646);
?>
[/code]

error:
PHP Warning:  date(): Windows does not support dates prior to midnight (00:00:00), January 1, 1970 in E:\client\vnh\_debug_tmp.php on line 3


is my windows screwed up or what?
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.