aka Blue Posted November 14, 2018 Share Posted November 14, 2018 Hi everyone! I have a little question about datetime function I use a MySQL database and I want to know the number of days that have passed. The format of datetime is: YYYY/MM/DD HH/MM/SS Is there any function to subtract the days and know how many have passed? In MTA or Lua because I know that exists datediff but i don't want to query all the time Thanks in advance! Link to comment
Discord Moderators Pirulax Posted November 14, 2018 Discord Moderators Share Posted November 14, 2018 I'd store a simple timestamp, then use getRealTime(timestamp), and there you go 1 Link to comment
aka Blue Posted November 15, 2018 Author Share Posted November 15, 2018 9 hours ago, Pirulax said: I'd store a simple timestamp, then use getRealTime(timestamp), and there you go Thanks for answering! Finally I used timestamp but I would like to know how to format the value to receive a date, like... Timestamp = 15351823012 Function that returns = 12-01-2018... ¿It is possible? Thanks in advance! Link to comment
aka Blue Posted November 15, 2018 Author Share Posted November 15, 2018 Fixed. The os.date function was the solution Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now