Date/Time Format - InfoPath Dev
in

InfoPath Dev

Use our Google Custom Search for best site search results.

Date/Time Format

Last post 12-07-2018 08:08 AM by runngun17. 2 replies.
Page 1 of 1 (3 items)
Sort Posts: Previous Next
  • 12-05-2018 08:59 PM

    Date/Time Format

    I would like to format my Date/Time field into this format: mm/dd/yyyy HH:MM (AM/PM).  I found this solution, but getting an error for some of the quotations:

    concat(substring(MyDateTime, 6, 2), “/”, substring(MyDateTime, 9, 2), “/”, substring(MyDateTime, 1, 4), ” “, substring(MyDateTime, 12, 2) mod 12 + 12 * (substring(MyDateTime, 12, 2) mod 12 = 0), substring(MyDateTime, 14, 3), ” “, substring(“AP”, 1 + (substring(MyDateTime, 12, 2) >= 12), 1), “M”) 

     

    To add to this, I changed my process to military time:

    concat(substring(TransferOutDatePatientLeftFacility, 6, 2), "/", substring(TransferOutDatePatientLeftFacility, 9, 2), "/", substring(TransferOutDatePatientLeftFacility, 1, 4), " - ", number(substring(TransferOutDatePatientLeftFacility, 12, 2)),":",number(substring(TransferOutDatePatientLeftFacility, 15, 2))) 

    For this, I would like to add a colon between the hour and mins field.  When I added it, it showed an error for the quotation mark before the colon. If I took the colon out, it worked.  However, it doesn't pull both of the mins fields.  It should pull two numbers.  But if the time is 13:00, it shows 130.  If the time was 1302, it shows 132.  Any thoughts.

    Filed under:
  • 12-07-2018 07:46 AM In reply to

    In your first formula I see some "smart quotes" that could be causing your issue - try removing those and typing them into your formula editor again. Also - I would probably not use a formula to format a date time - you can just add a calculated value to display it, and then set the calculated value control to date/time and set the format. If you are using a browser form, use one control for date and another for time.
    Hilary Stoupa

  • 12-07-2018 08:08 AM In reply to

     Thank you Hilary.  I ended up using a Drop Down for Hour and a drop down for minute pulling from a support list.  Then concat it to a field. 

Page 1 of 1 (3 items)
Copyright © 2003-2018 Qdabra Software. All rights reserved.
View our Terms of Use.