Skip to main content

Notifications

Power Pages - General Discussions
Answered

Date and Time field in form

Like (1) ShareShare
ReportReport
Posted on 4 Sep 2024 13:39:27 by 29
I have a requirement for a date and time field in a powerpages form.  It's not an automatic timestamp it's a field where the user enters the date and a particular time.  What's the best way to do this?  The corresponding DV field  where the data goes is a date/time field
Categories:
  • DBNL Profile Picture
    DBNL 29 on 06 Sep 2024 at 11:24:02
    Date and Time field in form
    Perfect thank you Fubar
  • Verified answer
    Fubar Profile Picture
    Fubar 7,637 on 05 Sep 2024 at 22:52:04
    Date and Time field in form
    If your dataverse Date is set to be Date Time (and is not set to Date only), then by default you should see the following, note the clock in red circle allows you to set Time.
     
     
    With JavaScript/JQuery you can also tell it to display the time side-by-side so rather than the button it appears to the right of the dates without a button click.
     
    $("#field_schemaname").next().data("DateTimePicker").sideBySide(true)
     
  • CU01101113-0 Profile Picture
    CU01101113-0 2 on 05 Sep 2024 at 14:29:41
    Date and Time field in form
    ok so  maybe I didn't explain it properly.
     
    My column in Dataverse is Date and Time.    At the Power Pages End I require the users to manually enter a date and a time.   The date picker only allows for date and automatically time stamps the time that they choose a date. I need them to be able to manually enter a specific time as well as date.
     
    In powerapps when I have requirement I just use drop downs with 24 and 60 items r..and then concatenate it with the date picker I just thought that maybe in Power Pages there maybe a better way to do it?
     
    thanks
     
     
  • Suggested answer
    GWham Profile Picture
    GWham 54 on 05 Sep 2024 at 10:05:47
    Date and Time field in form
    Place a date field on your form and the portal will render a date/time picker.
     
    if you want to set it to a specific date you can use:
    $("#your_fieldname").next().data("DateTimePicker").defaultDate(new Date("2020-01-01"));
     
     
     
  • Suggested answer
    Fubar Profile Picture
    Fubar 7,637 on 04 Sep 2024 at 22:12:39
    Date and Time field in form
    Not sure what you are actually after, if you want the portal user to enter a Date-time, then you have a Date field in Dataverse configured to not be Date only, add it to your form, and the portal will render a datetimepicker control for the user.
    Or do you want to populate it with data rather than the user entering the data (or default it to a value)?
    Or are you thinking you want 2 fields one for date one for time (this will be more difficult)?

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

End of Year Newsletter…

End of Year Community Newsletter…

Tuesday Tip #12 Start your Super User…

Welcome to a brand new series, Tuesday Tips…

Tuesday Tip #13 Writing Effective Answers…

Welcome to a brand new series, Tuesday Tips…

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 144,696

#2
RandyHayes Profile Picture

RandyHayes 76,287

#3
Pstork1 Profile Picture

Pstork1 64,456

Leaderboard
Loading started