top of page

Experiencing challenges with ServiceNow support?

IKC provides professional, reliable assistance that covers gaps not supported by ServiceNow

and without the high costs of traditional services.

 

Starting from just $1,000

How to Get Today's Date in MM-DD-YYYY Format in ServiceNow

Updated: Mar 29

Proper date formatting in ServiceNow scripts ensures accuracy, clarity, and consistency, particularly when working with international teams or integrations. This article demonstrates how to obtain today's date in the MM-DD-YYYY format, commonly used in various business scenarios, using ServiceNow scripting methods.


Understanding Date Formatting in ServiceNow

ServiceNow uses two main classes for date handling:

  • GlideDate: Manages date values without time information, ideal for date-only fields.

  • GlideDateTime: Includes date and time components, suitable for timestamp fields.

For date-only operations, GlideDate is typically simpler and more straightforward.


Correct Way to Retrieve Today's Date

Here's a simple and verified method to get today's date formatted as MM-DD-YYYY:

var currentDate = new GlideDate();
var formattedDate = currentDate.getByFormat("MM-dd-yyyy");
gs.info("Today's date: " + formattedDate);

Alternative Approaches & Troubleshooting

  • Using GlideDateTime: If working with timestamps, extract the date:

var gdt = new GlideDateTime();
var today = gdt.getDate();
var formattedDate = today.getByFormat("MM-dd-yyyy");
  • Common issues:

    • Ensure uppercase MM for month and lowercase dd for day.

    • Avoid mixing date and time formatting symbols.


Conclusion

To reliably format dates in ServiceNow, using GlideDate's getByFormat() method is recommended. This ensures clarity, reduces errors, and simplifies scripting tasks. Implementing these best practices helps maintain data consistency across your ServiceNow instance.

Experiencing challenges with ServiceNow support?

IKC provides professional, reliable assistance that covers gaps not supported by ServiceNow

and without the high costs of traditional services.

 

Starting from just $1,000

CONTACT

New Zealand HQ

Integrated Knowledge Consulting Office

Level 3, 93 Grafton Road

Auckland

South Korea

Integrated Knowledge Consulting Office

BMY역삼타워 6층

서울특별시 강남구 역삼동 678-10번지

 

info@ikconsulting.com

Thanks for submitting!

  • LinkedIn Social Icon

© Copyright 2025 Integrated Knowledge Consulting. All rights reserved.

bottom of page