• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Znote TFS 1.4 premium_ends_at

Solution
premium_ends_at stores the date when premium ends at, in unix_timestamp numeric format.

To get the value that represents "right now", you can use any of these functions:

In SQL queries, UNIX_TIMESTAMP()
SQL:
SELECT
	CONCAT('Current unix_timestamp is: ', UNIX_TIMESTAMP())

In Lua, os.time():
Lua:
print("Current unix_timestamp is: ".. os.time())

In PHP, time():
PHP:
echo "Current unix_timestamp is: " . time();

You can add seconds to this, or remove seconds from it to calculate time backwards and forwards.
Etc 7 days = 604800 seconds, so if you set premium_ends_at at current timestamp + 604800, they will have a week of premium.

This SQL query will set all accounts to have 1 week of premium:
SQL:
UPDATE...

Znote

<?php echo $title; ?>
Staff member
Global Moderator
Premium User
Joined
Feb 14, 2008
Messages
6,948
Solutions
252
Reaction score
1,896
Location
Norway
GitHub
Znote
premium_ends_at stores the date when premium ends at, in unix_timestamp numeric format.

To get the value that represents "right now", you can use any of these functions:

In SQL queries, UNIX_TIMESTAMP()
SQL:
SELECT
	CONCAT('Current unix_timestamp is: ', UNIX_TIMESTAMP())

In Lua, os.time():
Lua:
print("Current unix_timestamp is: ".. os.time())

In PHP, time():
PHP:
echo "Current unix_timestamp is: " . time();

You can add seconds to this, or remove seconds from it to calculate time backwards and forwards.
Etc 7 days = 604800 seconds, so if you set premium_ends_at at current timestamp + 604800, they will have a week of premium.

This SQL query will set all accounts to have 1 week of premium:
SQL:
UPDATE `accounts`
	SET `premium_ends_at` = UNIX_TIMESTAMP() + 604800

This SQL query will give 1 week of premium to everybody, if they already have premium, their premium will be extended by 1 week:
SQL:
UPDATE `accounts`
	SET `premium_ends_at` = CASE WHEN `premium_ends_at` > UNIX_TIMESTAMP()
    	THEN `premium_ends_at` + 604800
        ELSE UNIX_TIMESTAMP() + 604800
    END
 
Solution
Top