Skip to content

Extract and Convert Date in a Text or String to GlideDate Format #1125

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Oct 3, 2024

Conversation

selvarun-umass
Copy link
Contributor

Extract and Convert Date in a Text or String to GlideDate Format

Use Case / Requirement

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.

Solution

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.

Example Input and Output

  • Input Format: Example string containing patch information
    • Example: "kernel-headers-2.6.32-754.35.1.el6.x86_64 20 Nov 2020"
  • Output Format:
    • GlideDate format: 2020-11-20 (if displayed in yyyy-MM-dd format)

@Paulsylo25 Paulsylo25 self-assigned this Oct 3, 2024
@Paulsylo25
Copy link
Contributor

Thanks for your contribution towards #Hacktoberfest!

@Paulsylo25 Paulsylo25 merged commit 57bf1be into ServiceNowDevProgram:main Oct 3, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants