What time format is it - expires_in: 2678400


#1

Hello.

I have access_token that expires_in 2678400 and i need to check if there are week left, if true - update token. What i want to know is how to count it? What is 2678400? Month in seconds? So i need to save somewhere when i get token and then do:
date when i get token + expires_in = date when token will be invalid?


#2

2678400 = 60 * 60 * 24 * 31, so it’s 31 days in seconds. U can get real expiration time by addition current time in unix format (as example) and this number.

Example for get real expiration time (in UNIX format):
In SQLite: SELECT strftime(’%s’,‘now’) + 2678400;
in MySQL: SELECT UNIX_TIMESTAMP() + 2678400;