Skip to content
Advertisement

Convert Twitter Timestamp?

ive got the user created date timestamp using twitter API "created_timestamp": "1437815864820" but the timestamp is different from php time() format which is 1602426884.

and when i convert the twitter timestamp to date using date('m/d/Y', 1437815864820) it shows 12/09/41628 when it supposed between Agustus 2009 (my twitter created date).

ive searched around and unfortunately i cant find the solution for this, some says that it was 64bit format or something im not sure.

my goal is to check if the created timestamp is smaller than current timestamp, which mean that the user account was created before the specific timestamp

if( $created_timestamp < time() ){
//continue
}

Advertisement

Answer

Well I assume that the Timestamps are in milliseconds. In that case you need to convert them into seconds to be able to parse them.

echo date("m/d/Y", $created_timestamp / 1000);
User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement