Skip to main content

Hi Folks,

I am tinkering around in our new Nintex Forms subscription and I was trying to concatenate some date parts to generate a date format. All of my function works except for one line (the 7th line with concat method). I am not a JS expert but this seems like the correct syntax. Can anyone tell me where I went wrong?

Also, is there a better way to represent code blocks in forum posts?

function loadStrDate(){
    var curDate = new Date();
    var curMonth = curDate.getMonth();
    var curDte = curDate.getDate();
    var curMSYear = curDate.getYear();
    var curYear = curMSYear + 1900;
    var strDate = curMonth.cancat("/",curDte,"/",curYear);
    NWF$('#'+ jsvar_strDate).val(strDate);
};

Thanks and regards,

Patrick Kelligan

try this

function loadStrDate(){
    var curDate = new Date();
    var curMonth = curDate.getMonth();
    var curDte = curDate.getDate();
    //var curMSYear = curDate.getYear();
    //var curYear = curMSYear + 1900;
    var curYear = curDate.getFullYear();
    var strDate = String(curMonth).concat("/",curDte,"/",curYear);
    NWF$('#'+ jsvar_strDate).val(strDate);
};

That  did it! Thanks Marian!

How did you get the code block formatted like it is?


happy.png


Thanks Marian!


function loadStrDate(){
    var curDate = new Date();
    NWF$('#'+ jsvar_strDate).val((curDate.getMonth() + 1) + '/' + curDate.getDate() + '/' + curDate.getFullYear());
};‍‍‍‍‍‍‍‍

make sure you do the getMonth + 1 because its return value is from 0 to 11


Hi Andrew,

I incorporated your changes and it is much cleaner. Thanks for "+ 1" tip on the month!

Thanks and Regards,

Patrick


Reply