This script extracts a date from a string formatted as "20 Nov 2020" and converts it into the GlideDate format used in ServiceNow. This is particularly useful for maintaining accurate records of software patches and updates.
The solution utilizes the GlideDate
object to parse the date from the string and format it appropriately. The script extracts the day, month, and year, then constructs a formatted date string.
- Input Format: Example string containing patch information
- Example:
"kernel-headers-2.6.32-754.35.1.el6.x86_64 20 Nov 2020"
- Example:
- Output Format:
- GlideDate format:
2020-11-20
(if displayed inyyyy-MM-dd
format)
- GlideDate format:
Please find the attached javascript file to know how to implement it. Thank you!