How to convert this: 20220831T000000Z into a date time
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-20-2023 05:11 AM
How to convert this: 20220831T000000Z into a date time

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-20-2023 05:12 AM
Hi @Community Alums
That depends where you need to do this.
Help others to find a correct solution by marking the appropriate response as accepted solution and helpful.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-20-2023 05:40 AM
Hello @Community Alums
var datetime = dateString.split('T');
var date_part = datetime[0].trim();
var get_Time = datetime[1].split('.');
var time_part = get_Time[0].trim();
var resDate= new GlideDateTime(date_part.toString() + " " + time_part.toString());
date = resDate.toString();
gs.info(date);
Plz mark my solution as Accept, If you find it helpful.
Regards,
Samaksh

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-20-2023 06:19 AM
I don't think that works...
Hi @Community Alums You can use below script:
var date = '20220831T000000Z';
var gdt = new GlideDateTime(date.substring(0,4) + '-' + date.substring(4,6) + '-' + date.substring(6,11) + ':' + date.substring(11,13) + ':' + date.substring(13));
gs.info(gdt.getDisplayValue());
Time seems off, but that's based on my timezone 😉
Help others to find a correct solution by marking the appropriate response as accepted solution and helpful.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-26-2024 11:39 AM
1. Input Format: The string "20220831T000000Z" follows the ISO 8601 format for date and time representation.
2. ISO 8601 Components: Break down the string into its ISO 8601 components:
- Year: 2022
- Month: 08 (August)
- Day: 31
- Hour: 00
- Minute: 00
- Second: 00
- Timezone: Z (UTC)
3. Parsing Process: Utilize a programming language or tool to parse and extract the relevant information from the string.
4. Conversion Result: The converted date and time are August 31, 2022, at 00:00:00 UTC.
5. AI Automation: Artificial Intelligence AI technologies can automate the conversion process by developing algorithms that recognize and interpret date-time strings efficiently.
6. Enhanced Accuracy: AI tools can improve the accuracy of date-time conversions, minimizing the risk of errors associated with manual processing.
7. Speed and Efficiency: Leveraging AI for conversions enhances speed and efficiency, making it particularly useful for handling large datasets or dynamic timestamp changes.
8. Application Potential: The integration of AI in date-time conversions contributes to improved data processing capabilities, offering practical applications in various fields where precise temporal information is essential.