local function Comma(Amount)
while true do
local digit
Amount, digit = string.gsub(Amount, "(-?%d+)(%d%d%d)", "%1,%2")
if (digit == 0) then
break
end
end
return Amount
end
print(1 % 39)
local num = io.read()
num = (729891%86400)/36000
print(Comma(num))
local name = "Alice"
local age = 31
local dateOfBirth = "May 12th, 1994"
print(string.format("Name: %s, Age: %d, Date Of Birth: %s", name, age, dateOfBirth)) -- Output: "Name: Alice, Age: 30"
print(string.format("%.2f", 20))
local number = 6
local formatted = string.format("Number: %0" .. number .. "d", number)
print(formatted) -- Output: "Number: 0+(5)6"
local function timeUntilNY(targetYear, targetMonth, targetDay, targetHour, targetMin, targetSec)
-- Get current UTC time
local nowUTC = os.time(os.date("!*t"))
-- Define the target date and time in UTC
local targetDateUTC = {
year = targetYear,
month = targetMonth,
day = targetDay,
hour = targetHour,
min = targetMin,
sec = targetSec
}
local targetTimeUTC = os.time(targetDateUTC)
-- Calculate the difference in seconds
local difference = os.difftime(targetTimeUTC, nowUTC)
-- Determine if daylight saving time is in effect
-- For simplicity, assume standard offset is -5 hours (EST)
-- and daylight saving offset is -4 hours (EDT)
-- You can implement a check for DST if needed.
local isDST = false
local nowLocal = os.date("*t", os.time())
local year = nowLocal.year
-- Approximate DST start/end dates
-- In the US, DST starts second Sunday in March and ends first Sunday in November
local function isDSTActive()
local function secondSunday(year, month)
local date = os.time({year=year, month=month, day=8}) -- earliest second Sunday
local wday = os.date("*t", date).wday
local offset = (8 - wday) % 7
return os.date("*t", os.time({year=year, month=month, day=8 + offset}))
end
local function firstSunday(year, month)
local date = os.time({year=year, month=month, day=1})
local wday = os.date("*t", date).wday
local offset = (8 - wday) % 7
return os.date("*t", os.time({year=year, month=month, day=1 + offset}))
end
local dstStart = secondSunday(year, 3) -- March
local dstEnd = firstSunday(year, 11) -- November
local nowTime = os.time()
local startTime = os.time(dstStart)
local endTime = os.time(dstEnd)
return nowTime >= startTime and nowTime < endTime
end
isDST = isDSTActive()
-- Set the timezone offset
local offsetHours = isDST and -4 or -5
local offsetSeconds = offsetHours * 3600
-- Adjust the difference for timezone
local differenceNY = difference + offsetSeconds
local months = math.floor((differenceNY / 86400) / 30)
local weeks = math.floor((differenceNY / 86400) / 7)
local days = math.floor(differenceNY / 86400)
local hours = math.floor((differenceNY % 86400) / 3600)
local minutes = math.floor((differenceNY % 3600) / 60)
local seconds = math.floor(differenceNY % 60)
return months, weeks, days, hours, minutes, seconds
end
-- Calculate time until December 19, 2025, 0:00:00 (noon)
local months, weeks, days, hours, minutes, seconds = timeUntilNY(2025, 12, 19, 20, 0, 0)
-- Print the result
print(string.format("Time until December 19, 2025, 15:00:00: %d months, %d weeks, %d days, %d hours, %d minutes, %d seconds", months, weeks, days, hours, minutes, seconds))
local weeks = math.floor((780285 % 86400) / 7)
print(weeks)
To embed this project on your website, copy the following code and paste it into your website's HTML: