Custom date format? - InfoPath Dev
in

InfoPath Dev

Custom date format?

Last post 08-10-2011 12:51 PM by Jimmy. 3 replies.
Page 1 of 1 (4 items)
Sort Posts: Previous Next
  • 08-02-2011 09:35 AM

    Custom date format?

    Anyone know how I can setup a custom date format? I need the field to show the date in the following format: 08.02.2011

     

    I believe I can use xpath for this though I am not quite sure how to write it out.

  • 08-07-2011 10:35 PM In reply to

    Hi Lenovo27,

    Not sure if you can use 3rd party plugins or not, but qRules has a very powerful FormatDate feature.

     

    Patrick Halstead
    Project Manager at Qdabra
  • 08-09-2011 10:19 AM In reply to

    • Erich
    • Not Ranked
    • Joined on 07-27-2011
    • Posts 11

    Use the following code in javascript : 

     var zeros = ["01","02","03","04","05","06","07","08","09","10","11","12"];

    var oDate = new Date();
    date = odate.getDate();
    if(date < 10) date = zeros[date-1];

    strDate = zeros[odate.getMonth()] + "." + date + "." + odate.getFullYear();

    The zeros array is used so a zero is appended before any single digit.

     Erich

  • 08-10-2011 12:51 PM In reply to

    You can use an expression box (calculated value in 2010) with this XPath:

    concat(substring(dateField, 6, 2), '.', substring(dateField, 9, 2), '.', substring(dateField, 1, 4))

    Jimmy Rishe / Software Developer / Microsoft MVP
    Qdabra Software
Page 1 of 1 (4 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.