I need help with define how many years player is in roblox

hi i understand how to do it but I tried to do something like here:

Example:
image

I can’t only make the “Years”

i searched on os
and didn’t find anything

Do you want the years to be whole numbers? “5” instead of “5.3”? If so, you want

math.floor

no i want it to be like 5.30 and i don’t know how whats the Specifier

That probably gets the join date, subtracts it from today’s date, then divides by 365.25. I don’t know how to get the join date, so I’m stuck there.

||local joinTime = os.time() - (accAge*86400)|
||local joinDate = os.date(!*t, joinTime)|

soo you mean to change from “accAge*86400” to “accAge/365.25.1”

??

You can make use of a beautiful thing called DateTime to help yourself with this.

You can use local dateTime = DateTime.fromUnixTimestamp(86400 * playerYouAreChecking.AccountAge)
(with 86400 representing seconds in a day)

In order to get the years, you can simply FormatUniversalTime to convert that to a number variable, then subtract 1970 from it (which is the unix epoch year in of itself), such as:

local yearsOfAge = tonumber(dateTime:FormatUniversalTime('YYYY', 'en-us')) - 1970

This site shows a list for string formats in relation to os.date

You are likely looking for %Y

86400 is the seconds per day, so accAge seems to be age in days. Yes, divide by 365.25 to get years.

thats not work, can you make RBX example please
?

it works but i don’t see for example: “5.3” years
only full number

how can i see with the dot?

Your value is a Int or a Number value?

iys int value and, how can i devide it to for example: “5.3”

???

what i need to write to make the years with dots for example: “4.2”

.

Use a NumberValue, IntValues don’t allow decimals