×
×
• Create New...
• 0

# os.date("%M") - 50

## Question

• Moon
local time = os.date("%M")

local event_time = time - 60

So actually if i use this time - number and number is bigger than os.date("%M") i'm getting a crash and a negative result

Example:

os.date("%M") = 40
number = 50

I'm getting result -10 instead of 10

Any solution ? math.floor or something ?

• Created

## Recommended Posts

• 0

Hmm if I understand you well, your problem is just you sometimes get negative number, and its can not be converted to time format. So if this is the problem, try to use math.abs(number). This will convert all numbers to its absolute value.

The one and only UI programming guideline

##### Share on other sites

• 0
• Moon

I'm getting the correct result but negative only when the number is bigger than the actual time(minute)

##### Share on other sites

• 0

Then use math.abs(number).

For example:

You have number -50. --> math.abs(-50) --> now you get number 50.

The one and only UI programming guideline

• 0

Use math.abs.

• 1
##### Share on other sites

• 0
• Moon

Posted April 13, 2015

• 0

oh lol.

• 1

## Create an account

Register a new account

1. 5

2. 0

3. 82

4. 23

5. 23

6. 27

7. 2

8. 30

9. 672