-
Notifications
You must be signed in to change notification settings - Fork 808
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Optimized: Date-Time conversion and processing #1621
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hello, This is because local tst = 1337 ; util = {}
function util.DateStamp()
local t = os.date( '*t' ) -- No second argument to be converted
return t.year .. "-" .. t.month .. "-" .. t.day .. " " .. ( "%02i-%02i-%02i"):format( t.hour, t.min, t.sec )
end
function util.DateStamp2( vS )
return os.date( "%Y-%m-%d %H:%M:%S", vS )
end
print(util.DateStamp(tst), util.DateStamp2(tst)) If the users desires the current date and not some other specific date to be converted they can pass print(util.DateStamp(nil), util.DateStamp2(nil))
2023-11-1 19-19-35 2023-11-01 19:19:35 The function can be optimized to internally use |
Fair enough, I have missed that the original had no arguments. Still, I do not think we need those other 2 functions, and I am still not sure about the formatting change. |
Well, time format is standardized across the world for using There is no harm in having the other two functions I think as the more, the merrier... They will be useful when the user requests only the date or the time part of |
The point is not what format is common or what your preference is, the point is what it already is before your changes. Changing it can have adverse effects on existing scripts who may or may not expect a specific format. These issues happen time and time again with these PRs and with other changes to existing API functions. On the topic of the 2 extra functions, they are just an alias of |
Adding |
Fair enough :D |
No description provided.