Date and Time to two variables in JS

178 views
Skip to first unread message

onei...@gmail.com

unread,
Aug 26, 2014, 11:44:04 AM8/26/14
to suppor...@runmyprocess.com
Hi

I'm posting data from a webinterface into a collection upon a button being clicked.

At the time of the button being clicked I want to record a time and date stamp also for that record in the collection

How, in JS, can I capture the date and time in two different variables?

I have checked the online docs but I wasn't clear how to translate this to my requirements.

many thanks

Jamie

Shobhit Tripathi

unread,
Aug 27, 2014, 2:38:19 AM8/27/14
to suppor...@runmyprocess.com
Hi Jamie,

As per your requirement, you have to use Two text Input widget in Web-Interface. In which one is for Date and another is for Time.
Then use below JavaScript code to set Current Date and Time in those Widgets.

// For Current Date
    var today = new Date();
    var dd = today.getDate();
    var mm = today.getMonth()+1;
    var yyyy = today.getFullYear();
    today = mm+'/'+dd+'/'+yyyy;
    id_date.setValue(today);  // id_date is your identifier of your input variable

// For Current Time
    var currentTime = new Date()
    var hours = currentTime.getHours()
    var minutes = currentTime.getMinutes()
    currentTime= hours + ":" + minutes;
    id_time.setValue(currentTime);   // id_time is your identifier of your input variable



After then you have to use variable of your Date and Time widget (of your Web Interface) inside your code in which you are saving the data into collection.

If you are still having any doubt, then feel free to ask.

Thanks & Regards
Shobhit



--
Fujitsu - RunMyProcess
---
You received this message because you are subscribed to the Google Groups "RunMyProcess Support Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to supportforum...@runmyprocess.com.
To post to this group, send email to suppor...@runmyprocess.com.
Visit this group at http://groups.google.com/a/runmyprocess.com/group/supportforum/.
To view this discussion on the web visit https://groups.google.com/a/runmyprocess.com/d/msgid/supportforum/6b9468ee-8588-47ed-98e2-ebc12709a032%40runmyprocess.com.
For more options, visit https://groups.google.com/a/runmyprocess.com/d/optout.

onei...@gmail.com

unread,
Aug 27, 2014, 6:04:57 AM8/27/14
to suppor...@runmyprocess.com, onei...@gmail.com
That worked great, thank you :)
Reply all
Reply to author
Forward
0 new messages