Custom Date Format

  • WSIguy
    Asked on April 11, 2019 at 3:43 AM

    Hi,

    I would like to display the date the form was sent in a customized format (for Japanese).

    So for April 11, 2019
    I need to have it render as:
    2019年4月11日

    I am fiddling around with adding a date field, hidden, set for Today.
    Then I need to extract 2019, 4, and 11 (yyyy, m, d) from the actual date and render each bit with a calculation field (or similar?).

    I am sure this can be done, but I am unsure if I should use date() or datestring() in order to retrieve the y m d bits.

    Your help would be appreciated.

    Thanks,
    Bruce

    PS: This does not pertain to a particular form at present, so I don't provide link to a form.

  • Victoria_K
    Replied on April 11, 2019 at 7:02 AM

    Hello Bruce,

    Is the task just to display the date in the format you specified? 

    If so, I can suggest to try a Text element:

    Custom Date Format Image 1 Screenshot 20

    Here is a test form: https://www.jotform.com/91002763653958 

    I have also tried to retrieve d, m, y using a Substring widget, but unfortunately this can only work if date is entered by a user, widget will not run for default date. 

  • WSIguy
    Replied on April 11, 2019 at 8:15 AM

    Thanks, but, I can't get it to work here:

    https://www.jotform.com/build/90993214884468

    It just renders as 年月日

    I wonder what I am doing wrong?

    Also, and I know this is picky, but is there a way to have it render with 4 and not 04?

  • Victoria_K
    Replied on April 11, 2019 at 9:29 AM

    Unique Name of your date field would be 'today', so you should use {today:month} etc. 

    Custom Date Format Image 1 Screenshot 20

    Regarding '4 and not 04', this does not seem to be an easy task, maybe there could be a CSS solution. If this is important for your case, we can check for possible code for ready form. 

  • WSIguy
    Replied on April 11, 2019 at 9:45 AM

    Thanks a lot!
    Yep, that solved that.

    Don't worry about the 04 vs 4 for now.
    That said, I serve clientele in Japan. The Japanese are super particular so presentation needs to be perfect all the time.

    Typically, we/they would use 2019.04.11
    But when inserting the Asian characters, would not use the preceding 0's.

    Thanks again!

  • Victoria_K
    Replied on April 11, 2019 at 11:26 AM

    Okay, let us know if you will need more help on this. :)