web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Textinput box date and...
Power Apps
Answered

Textinput box date and time validation in power apps

(0) ShareShare
ReportReport
Posted on by 19

Hi, Good day!
I have created a new power app.
In the application one of the text input field user will update date and time values
Ex format : 29/12/2022 10:30 AM

Before saving the data I need to validate the format like (DD/MM/YYYY HH:MM AM/PM).

Could you please some one help if user entered the wrong format need through error message or highlight the field.

Categories:
I have the same question (0)
  • virksami Profile Picture
    59 on at

    Why you don't use date picker control instead of text input?

  • Nikilp Profile Picture
    19 on at

    Hi, In my application we needs to update multiple date and time fields. Users will directly copy and paste the details.

  • WarrenBelz Profile Picture
    156,386 Most Valuable Professional on at

    Hi @Nikilp ,

    You can use this test - Note the last bit just needs to be something the date will always be after

    DateTimeValue(YourTextBoxName.Text) > Today() - 60

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

    MVP (Business Applications)   Visit my blog Practical Power Apps

  • Nikilp Profile Picture
    19 on at

    Hi, Good day!

    It's not working.

    In the TEXT INPUT box user needs to update below format

    Ex. 27/Dec/22 9:30 AM

    01/Jan/23 10:20 PM

    If user entered the wrong format needs to show the alert message befor submit.

    Wrong format examples. 27/ Dec/22

    27/Dec/22 10:30 A

    27/Dec/22 10 AM

    Could you please help.

     

  • WarrenBelz Profile Picture
    156,386 Most Valuable Professional on at

    @Nikilp ,

    If you are going to use text instead of a date picker, then the format that you regard as valid needs to be one recognised by Power Apps as a valid date. 27/Dec/22  9:30 AM is not a valid date/time and would require a heap of code gymnastics to validate manually (which my brain hurts thinking about). 27/12/2022 09:30 AM is valid and would work with the formula I provided. Please consider using a date picker and your minute/drop-downs or change the format valid of the Text.

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

    MVP (Business Applications)   Visit my blog Practical Power Apps

     

     

     

  • Verified answer
    SitaramamurthyJ Profile Picture
    12 on at

    Hello Nikilp, 
    Try this code in OnChange property of the text field. When wrong format entered and moves to next field, it will display error notification.

    If(!IsMatch(TextInput3.Text,"\d{2}/\d{2}/\d{4} (1[0-12]|[1-9]):[0-5][0-9] ([AaPp][Mm])"),
    Notify("Please enter DD/MM/YYYY 00:00 AM/PM Format",
    NotificationType.Error);Reset(TextInput3));

  • Nikilp Profile Picture
    19 on at

    Hi @SitaramamurthyJ ,

     

    Good day!

    The above code works if we use the 02/02/2023 10:30 AM format, but I am using 02/Feb/2023 10:30 AM.

    Can you please help?

  • SitaramamurthyJ Profile Picture
    12 on at

    Hello @Nikilp ,

    Then try this code on OnChange property of the text field.

    If(
    !IsMatch(
    TextInput1.Text,
    "^(([0-9])|([0-2][0-9])|([3][0-1]))\/(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\/\d{4} (1[0-12]|[1-9]):[0-5][0-9] ([AaPp][Mm])"
    ),
    Notify(
    "Enter DD/MMM/YYYY HH:MM AM/PM Format",
    NotificationType.Error
    );
    Reset(TextInput1)
    )

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 379 Most Valuable Professional

#2
11manish Profile Picture

11manish 203 Super User 2026 Season 2

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 128 Super User 2026 Season 2

Last 30 days Overall leaderboard