• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Pawn] Add days to current time
#1
I'm saving the last login date/time using Now() in MySQL which sets a string such as?2021-12-28 12:41:53



I want to check if 30 days have passed since the last login. How can I do this in the script? I imagine I would have to use a different method of saving the date in order to check this.
  Reply
#2
Use unix time.



PHP Code:
// On player logged-in

format(querysizeof query"UPDATE `users` SET `last_login` = %i WHERE `id` = %i"gettime(), id);



// Check?player last login

cache_get_value_name_int(0"last_login"value);

if(
gettime()-value 60*60*24*30) {

? ? 
// 30 days passed from last login


  Reply
#3
Don't use formatted dates ever. Just save your data using unix timestamps. They make everything with time way way easier.
  Reply


Forum Jump: