- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-29-2024 04:18 AM
Hi,
I am triggering an inbound email action where below is my email body format
Then am capturing this date in action as below
Here, gdt is reading false value and assigning the same into field on my form.
Expected Result:
gdt value must be 09:00
Also, suggest me how can I read 12 hours time and convert it into 24 hours time format so that 09:00 PM should be taken as 21:00 as result.
Thanks
M.Kavya.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-29-2024 03:29 PM
Hi, unfortunately screenshots do not allow the community to properly evaluate\test your issue and plain text is the best method to share this type of detail.
GlideDateTime can understand your date if you substring the appropriate details from your text,
but I'm not sure if there is a way to recognize AM/PM and the simple fix for this (if no one else has a better solution) would be to add 12 hours if the AM/PM reference is PM.
var testDate = 'REPORTED AT: 29-Jan-2024 09:00:00 AM UTC | 29-Jan-2024 02:30:00 PM IST';
var myDate = testDate.substring(testDate.indexOf(':') + 2, testDate.indexOf('UTC') - 4);
var amPM = testDate.substring(testDate.indexOf('UTC') - 3, testDate.indexOf('UTC') - 1)
var gdt = new GlideDateTime();
gdt.setValueUTC(myDate,'dd-MMM-yyyy hh:mm:ss');
if(amPM == 'PM') {
gdt.addSeconds(43200); // add 12 hours
}
gs.info(gdt);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-29-2024 03:29 PM
Hi, unfortunately screenshots do not allow the community to properly evaluate\test your issue and plain text is the best method to share this type of detail.
GlideDateTime can understand your date if you substring the appropriate details from your text,
but I'm not sure if there is a way to recognize AM/PM and the simple fix for this (if no one else has a better solution) would be to add 12 hours if the AM/PM reference is PM.
var testDate = 'REPORTED AT: 29-Jan-2024 09:00:00 AM UTC | 29-Jan-2024 02:30:00 PM IST';
var myDate = testDate.substring(testDate.indexOf(':') + 2, testDate.indexOf('UTC') - 4);
var amPM = testDate.substring(testDate.indexOf('UTC') - 3, testDate.indexOf('UTC') - 1)
var gdt = new GlideDateTime();
gdt.setValueUTC(myDate,'dd-MMM-yyyy hh:mm:ss');
if(amPM == 'PM') {
gdt.addSeconds(43200); // add 12 hours
}
gs.info(gdt);