How to populate a text field from date field in another format?

  • daviddekel
    Asked on May 4, 2015 at 2:37 AM

    If i have a date field thats populated like this: 2015-10-28

     

    I need to move this over to a text box which will show the same:  2015-10-28

     

    But when I use the update form field in the conditions it outputs as 1823984

     

    I used the date function and it outputed as : 2015/10/28,   but i need it as 2015-10-28

     

    Is there a function to be able to do this?

  • Welvin Support Team Lead
    Replied on May 4, 2015 at 10:25 AM

    I tried, but I think there's no way you can use a hyphen as the date separator when adding the date through calculation.

    Your form is configured and using the DateString function for the field "Webinar Date - (Eastern time - New York)". Are you all set now or really wanted to have it as Year-Month-Date? I can submit this thread as a feature request if you want.

    Thanks

  • wsfarm
    Replied on May 4, 2015 at 10:39 AM

    Hi David,

    I have just been doing something similar.

    Keep your date field as is, and your text field.

    Also keep your update condition or set it as:

    How to populate a text field from date field in another format? Image 1 Screenshot 40

    just add another condition to set a mask on the text field of ####-##-##

    ( a quicker and easier way to set the mask is to do it directly in the properties of the text box.)

    How to populate a text field from date field in another format? Image 2 Screenshot 51

    It will replace the /s with -s keeping the date the same:

    How to populate a text field from date field in another format? Image 3 Screenshot 62

    Cheers

    Charlie

  • daviddekel
    Replied on May 4, 2015 at 11:17 AM

    Thanks Charlie!

    that worked!

  • Welvin Support Team Lead
    Replied on May 4, 2015 at 11:57 AM

    Very clever, Charlie. Thank you very much :)

  • wsfarm
    Replied on May 4, 2015 at 5:12 PM

    Glad to be able to help.

    It just so happened that your post popped up next to one of mine and caught my eye as I had just worked out how to reformat dates myself.

    And a quicker and easier way to set the mask is to do it directly in the properties of the text box.

    All the best 

    Charlie

  • Ben
    Replied on May 4, 2015 at 6:07 PM

    Thank you for the nice and simple (yet smart) way to accomplish that Charlie :)

    If someone comes to this thread looking for the quicker way that you have mentioned. This is achieved by clicking on the Text Box field that you want to have the mask set on and then clicking on the Input Mask button in the toolbar and adding ####-##-##

    How to populate a text field from date field in another format? Image 1 Screenshot 20

    The mask can be different if you need it what is important to note is that:

    @ is used to represent a letter

    # is used to represent a number

    * is used to represent both letter and a number

    so when you add ####-##-## you are saying that you are expecting 4 numbers and that you want - (minus dash) to be added there followed by 2 more numbers, another dash and another set of 2 numbers.

    So if someone wants, it would be easy to make the date show 2015/05/05 instead of 2015-05-05, or use any number or type of filler (between the numbers) that they need.

  • Charlie
    Replied on September 18, 2015 at 12:34 PM

    @grade4pagasa

    To better assist you, I went ahead and opened a separate thread for this, please refer to this link instead: http://www.jotform.com/answers/665249. We will address it shortly.

    Thank you for understanding.