Os.date

I’m trying to produce a plugin that tracks how many hours you have worked on a project and when you worked them. Every single source for converting a tick() into the necessary information uses os.date, which is conveniently not allowed in roblox. If there is a reason why os.date is not allowed in roblox, it would be nice to know, otherwise, please put this in.

Use this to calculate the date. It’s what I’ve always done.

function time(s)
	local s=type(s)=='number' and s or os.time()
	local fy,dim=math.floor(s/126230400),{31,0,31,30,31,30,31,31,30,31,30,31}
	local y,s,m,d,h,mm=fy*4,s-(126230400*fy)
	for i=1,4 do local sy=i==2 and 31622400 or 31536000
		if s<(sy) then break
		else y=y+1 s=s-(sy)
	end end
	for i=1,12 do local sm=(i==2 and ((y%4)==0 and 29 or 28) or dim[i])*86400
		if s<(sm) then m=i break
		else s=s-(sm)
	end end
	local d=math.floor(s/86400) s=s-(d*86400)
	local h=math.floor(s/3600) s=s-(h*3600)
	local mm=math.floor(s/60) s=s-(mm*60)
	return {
		Year=1970+y,
		Month=m,
		Day=d+1,
		Hour=h,
		Minute=mm,
		Second=s,
	}
end

[quote] Use this to calculate the date. It’s what I’ve always done.
-snip-
[/quote]

I think his point is that he doesn’t feel like putting in 24 lines of code when we really only need the 9 characters that are os.date().

What irritates me most is that this has been suggested multiple times:

PLEASE can we have this enabled? It would be so useful.

Interns, please?