PM or AM with auto time? - InfoPath Dev
in

InfoPath Dev

PM or AM with auto time?

Last post 07-28-2009 09:52 AM by Gagan. 6 replies.
Page 1 of 1 (7 items)
Sort Posts: Previous Next
  • 07-08-2009 07:26 AM

    • Gagan
    • Top 500 Contributor
    • Joined on 06-02-2009
    • Posts 31

    PM or AM with auto time?

    hi all,

     I'm using the function "substring-after(now(), "T")" to populate current time. is there any way to add PM/AM to that automatically?

     Thanks!

  • 07-08-2009 07:35 AM In reply to

    • Gagan
    • Top 500 Contributor
    • Joined on 06-02-2009
    • Posts 31

    Re: PM or AM with auto time?

    actually just figured it out,

    for those wondering, change the data type to Time, and click format.

     

    EDIT: actually the whole purpose of this form is to submit it to sharepoint, and what i did only changes the display on infopath form, and doesnt submit the data as AM or PM in sharepoint. any ideas?

  • 07-08-2009 08:47 AM In reply to

    Re: PM or AM with auto time?

    That's all just display whether it's in InfoPath or SharePoint.  The true XML underneath the covers is a raw number...same for both InfoPath and SharePoint.

    What is your end goal?

  • 07-09-2009 05:23 AM In reply to

    • Gagan
    • Top 500 Contributor
    • Joined on 06-02-2009
    • Posts 31

    Re: PM or AM with auto time?

    thanks for the response.

    my end goal is to have the sharepoint list show weather it is AM or PM, so that my end-user can view the data right there, and export to excel if needed

     

    EDIT: so i came up with a temp soultion, which included having my submit button, which was coded, also have Rules, which were to set a node to the Fx (substring-after(now(), "T")) then set a node to AM or PM depending on weather the first node was after or before noon and after or before midnight. then set the final node that is displayed on my form to (concat(node1, " ", node2)).

    the problem is that the Fx (substring-after(now(), "T") brings up the time in military time, so even though it looks okay when it is AM, when it switches over to PM, military time and the following PM doesnt look right.

     basically i need to change my (substring-after(now(), "T"))  formula to be normal time, and not military. is there a way to do this?

     thanks so much!

  • 07-09-2009 08:46 AM In reply to

    Re: PM or AM with auto time?

  • 07-10-2009 06:14 AM In reply to

    • Gagan
    • Top 500 Contributor
    • Joined on 06-02-2009
    • Posts 31

    Re: PM or AM with auto time?

    as soon as I read your response, i facepalmed, and said DUH!

    but when I actually sat down to code it into the rules, I couldnt figure out the formulas.

    Any Help?

    got it!

    used concat(addSeconds(Timenumber, -43200), " ", timeamorpm)

    im actually kind of proud of myself since im such a dunce at programming.

  • 07-28-2009 09:52 AM In reply to

    • Gagan
    • Top 500 Contributor
    • Joined on 06-02-2009
    • Posts 31

    Re: PM or AM with auto time?

    ran into a problem with my function.

     

    when the time is during nonn (Ex: 12:15:00 PM) my code will make it so it is (00:15:00 PM)

     

    any way to fix this?

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