Jump to content

25 Mai 2020? if dataFormat?


vilhem

Recommended Posts

  • Moderators
24 minutes ago, vilhem said:

I'm interested in what I should use to access a certain date, for example: May 20, 2020;

getRealTime: https://wiki.multitheftauto.com/wiki/GetRealTime

It returns by default the current date.

 

timestamp can help you with calculate offset. Easy to use and no formatting required.

 

local timestamp = getRealTime().timestamp -- seconds

local days = 10
local futureTimestamp = timestamp + (60 * 60 * 24 * days)

 

if timestamp >= futureTimestamp then
  
end

 

To get other date formats.

Member Meaning Range
second seconds after the minute 0-61*
minute minutes after the hour 0-59
hour hours since midnight 0-23
monthday day of the month 1-31
month months since January 0-11
year years since 1900
weekday days since Sunday 0-6
yearday days since January 1 0-365
isdst Daylight Saving Time flag
timestamp seconds since 1970 (Ignoring set timezone)  
local time = getRealTime()
local hours = time.hour
local minutes = time.minute

 

These are the bricks you can use and the rest is up to your math skills.

Edited by IIYAMA
Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...