Can MineTest check the real-life date ?

Post Reply
User avatar
davidthecreator
Member
Posts: 452
Joined: Mon Aug 18, 2014 19:48
GitHub: daviddoesminetest
In-game: DavidDoesMinetest
Location: Lithuania

Can MineTest check the real-life date ?

by davidthecreator » Post

Is There a way MineTest could check, which day of which month it currently is, on the calendar of the device MineTest is running on?

User avatar
Linuxdirk
Member
Posts: 3219
Joined: Wed Sep 17, 2014 11:21
In-game: Linuxdirk
Location: Germany
Contact:

Re: Can MineTest check the real-life date ?

by Linuxdirk » Post

os.date() is available, so, yes.

https://www.lua.org/pil/22.1.html

Code: Select all

local date = os.date('*t')
Now date is a table holding all relevant date information.

Code: Select all

{
    ["hour"] = 6,
    ["min"] = 18,
    ["wday"] = 2,
    ["day"] = 11,
    ["month"] = 2,
    ["year"] = 2019,
    ["sec"] = 36,
    ["yday"] = 42,
    ["isdst"] = false
}
If you only need specific things and don't want to get tehm by using the table keys use the desired tag. %m for month or %d for day. See link above for more information.

This always gets the date/time of the server, not of the individual clients connecting to the server.

yw05
Member
Posts: 368
Joined: Tue May 07, 2019 12:59
GitHub: y5nw
IRC: y5nw
In-game: ywang
Location: Germany

Re: Can MineTest check the real-life date ?

by yw05 » Post

If you want to get the time in-game, use a Luacontroller. I found a short link to the manual.

Post Reply

Who is online

Users browsing this forum: No registered users and 7 guests