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 06:34 AM
is this line present in client controller?
c.form.u_arrival_date = new Date();
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:07 AM
is it client controller?
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:17 AM
Yes
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-07-2023 07:31 AM
then use this
var today_date = new Date();
var today_date_str = formatDate(today_date, g_user_date_format);
c.form.u_arrival_date = today_date_str;
If my response helped please mark it correct and close the thread so that it benefits future readers.
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:35 AM
it said the date and time like below:
2023-07-07 00:00:00
Requirements want it to be saved like below example with whatever the current day is and users time is:
07/13/2023 09:44:40