Can MineTest check the real-life date ?
- 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 ?
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?
- 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 ?
os.date() is available, so, yes.
https://www.lua.org/pil/22.1.html
Now date is a table holding all relevant date information.
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.
https://www.lua.org/pil/22.1.html
Code: Select all
local date = os.date('*t')
Code: Select all
{
["hour"] = 6,
["min"] = 18,
["wday"] = 2,
["day"] = 11,
["month"] = 2,
["year"] = 2019,
["sec"] = 36,
["yday"] = 42,
["isdst"] = false
}
This always gets the date/time of the server, not of the individual clients connecting to the server.
-
- 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 ?
If you want to get the time in-game, use a Luacontroller. I found a short link to the manual.
Who is online
Users browsing this forum: No registered users and 7 guests