How to know the exact day of the week from a Date/Time field
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-12-2024 12:27 AM
Hi,
Is there any way to know the exact day of the week from Date/Time and the exact time that was chosen
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-12-2024 12:54 AM
Hi @Alon Grod ,
There is a function which can let you know that , refer the below script.
var grDay= new GlideRecord('your_table_name');
grDay.query();
while (grDay.next()) {
var gdt = new GlideDateTime(grDay.date + ' 12:00:00');
var dy = gdt.getDayofWeekLocalTime();
gs.info('Day:'+dy);
}
☑️ Please mark responses as HELPFUL or ACCEPT SOLUTION to assist future users in finding the right solution....
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-12-2024 01:02 AM
@Sohail Khilji and how can I get the exact time from the date?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-12-2024 02:32 AM
the date and time field consist of 2 components once is date and another is time , you can refer the 2nd segment to get the time.
☑️ Please mark responses as HELPFUL or ACCEPT SOLUTION to assist future users in finding the right solution....

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-12-2024 05:29 AM
Hi @Alon Grod ,
Please try below code may be this will work you