Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How do get the REAL date? It looks simple.

I am trying to make it so if it is Friday there will be special deal's in the shop. I have looked through tons of questions and only found super complex answers. I found on the wiki that when called with a data table it should return a table or something? :P I am new with tables... But anyway it looks like it should be pretty easy to get the month, day, hour, year, etc. As said I am new with table so could someone help explain this?

2 answers

✓ Accepted answer

That API refers to passing in dates, not getting them back. Roblox doesn't provide a way to get real dates back out as of right now. (This would be os.date in real Lua.)

Despite this, it's still possible, albeit challenging, to get the real date by mathematical calculation on the Unix epoch.

For a quick answer, you can use the following code which will print the current day (e.g. Friday) using a module written by BlueTaslem.

local Date = require(271818993)

print(Date():format( "Week" )) --> Friday

For further reading, see:

4 comments

0

Computing day-of-the-week is literally the easier operation and I had a typo in it. I'm not sure how that got past me when I tested. The module is updated to give the correct day-of-week now.

0

You might also be able to use HttpService and get the date from an API on the Internet.

0

ok

0

Thanks so much!!

Enable HTTPService and use this:

local hs = game:GetService("HttpService")
				
			
				local rawdata = hs:GetAsync("https://www.checkiday.com/", true)
			
				
				
				if(type(rawdata)=='string') then
				--	print(rawdata)
				local result=	rawdata:match('\<meta name="description" content="(.+)- Today')
				print("today is: "..result)
end

This discussion is preserved as it was. New answers, comments, and votes are closed.