Current time value
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-07-2023 06:09 AM
I created table on a widget that has columns. One of the column fields is a date/time field.
Currently the date shows up correct but it's not pulling in the current time value. How do I also add the current time into the date field value in GMT stored in 'u_arrival_date'?
Currently in my widget to pull the date I coded:
c.form.u_arrival_date = new Date();
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-07-2023 07:38 AM
it's date/time field or date type?
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-07-2023 07:43 AM
date/time field
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-07-2023 08:03 AM
date/time
Here is what I coded in my client controller. However, it is not converted to the correct gmt time zone. So, it shows my current time but when I refresh the page it goes back 5 hours.
c.form.arrivalDate = new Date();
c.form.arrivalTime = new Date();
var arrivalDate = c.form.u_arrival_date;
var arrivalTime = c.form.u_arrival_time;
function combineDateTime(arrivalDate, arrivalTime){
return (arrivalDate.getFullYear()+ '-'+ (arrivalDate.getMonth()+1).toString().padStart(2, '0')+'-'+ arrivalDate.getDate().toString().padStart(2,'0')+' '+arrivalTime.getHours().toString().padStart(2,'0')+':'+arrivalTime.getMinutes().toString().padStart(2,'0'));
}
c.form.u_arrival_date = combineWithTime(c.form.arrivalDate,c.form.arrivalTime);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-07-2023 09:22 AM
what type of field is it?
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-07-2023 09:25 AM
Date/Time Type