Created
March 28, 2012 05:44
-
-
Save fjcero/2223967 to your computer and use it in GitHub Desktop.
Conversion de Twitter Status ID
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Python | |
====== | |
>>> status_id = int(184846323277770752) | |
>>> timestamp = (status_id >> 22) | |
>>> print timestamp | |
44070797748 | |
>>> timestamp = (status_id >> 22) + 1288834974657 | |
>>> print timestamp | |
1332905772405 | |
>>> import time | |
>>> print time.ctime(timestamp/1000) | |
Wed Mar 28 00:36:12 2012 | |
PHP | |
=== | |
php > $status_id = '184846323277770752'; | |
php > $timestamp = ($status_id >> 22); | |
php > echo $timestamp; | |
511 | |
php > $timestamp = ($status_id >> 22) + '1288834974657'; | |
php > echo $timestamp; | |
1288834975168 | |
The integer value of var on success, or 0 on failure. Empty arrays return 0, non-empty arrays return 1. | |
The maximum value depends on the system. 32 bit systems have a maximum signed integer range of -2147483648 to 2147483647. So for example on such a system, intval('1000000000000') will return 2147483647. The maximum signed integer value for 64 bit systems is 9223372036854775807. | |
Strings will most likely return 0 although this depends on the leftmost characters of the string. The common rules of integer casting apply. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Para leer con menos sueño:
http://stackoverflow.com/questions/300840/force-php-integer-overflow