How to create a date time input mask in a TextBox

How to create a typing mask in a textbox, where while I type only the numbers, they will automatically fit in the mask dd/mm/yyyy hh:mm?

Ex: I type 011220221645 and it’s being formatted to 01/12/2022 16:45

  /  /
0 /  /
01/  /
01/1 /
01/12/
01/12/2
01/12/20
01/12/202
01/12/2022
.
.
.
1 Like

i dont understand verry well, you want a system to detect what is the hour month and year?

I have a TextBox field to get a Date and Time typed by the user.
I don’t want him to have to type / separators for date and : for time.
This is a simple and common case in any system.

1 Like

yeah but i think that is not possible because the player can type and date, you want like that?

else you can just use this script

local dt = DateTime.now()

wait(2)

print("The date is " .. dt:FormatLocalTime("l", "en-us"))

i dont really understand them either but this should help

I think I understand what you’re trying to do. My code may be a bit verbose, but this is the quickest way I could think of right now. Here it is in action:

You can grab the model here.

I hope I was of help. :smiley:

2 Likes

That’s excellent.
Thank you!


2 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.