What It Does

The after() method performs a chronological comparison between two GlideDateTime objects. It evaluates whether the calling object represents a moment in time that occurs after the moment represented by the parameter object. The comparison is precise down to the millisecond level and accounts for timezone differences by normalizing both dates to UTC before comparison.

Internally, ServiceNow converts both GlideDateTime objects to their millisecond representations since epoch (January 1, 1970, 00:00:00 UTC) and performs a simple numeric comparison. This ensures consistent behavior regardless of the timezone settings of the ServiceNow instance or the user session context.

The method returns a boolean value: true if the calling object is chronologically after the parameter, and false in all other cases, including when the dates are equal or when invalid parameters are passed. The method never returns null or throws exceptions for invalid input.

Edge cases include comparing dates with identical timestamps (returns false), passing null or undefined parameters (returns false), and comparing GlideDateTime objects with invalid internal values (returns false). The method is null-safe and will not cause script errors even with malformed input.

This method works in conjunction with before() and equals() methods to provide complete chronological comparison capabilities. Unlike string-based date comparisons, these methods handle timezone conversions and daylight saving time transitions correctly.

When to Use This

Use after() when you need to validate date ranges, calculate SLA breaches, or implement workflow logic based on chronological order. Common scenarios include checking if an incident's resolution time exceeded its due date, validating that end dates come after start dates in scheduled items, or determining if a user's access should be revoked based on expiration dates.

Avoid using string comparison operators (>, <) on date strings or using getNumericValue() for date comparisons. These approaches are error-prone and don't handle timezone differences correctly. For date arithmetic (finding differences between dates), use GlideDateTime.subtract() instead of comparison methods.

Return Value

Returns a boolean true if the calling GlideDateTime object represents a point in time chronologically after the parameter object. Returns false in all other cases: when the parameter date is after or equal to the calling object's date, when either object contains invalid date data, or when the parameter is null or undefined.

The return value is always a proper boolean type, never null or undefined, making it safe to use directly in conditional statements without additional null checks. The method fails silently by returning false rather than throwing exceptions, so always validate your input data if the distinction between 'invalid comparison' and 'chronologically before' matters for your business logic.

Free Newsletter

Enjoying this? Get one deep-dive per week.

Join 1,000+ ServiceNow pros — scripts, GlideRecord patterns, Flow Designer techniques, and career moves. Free.

No spam · Unsubscribe anytime

Platform Behavior & Side Effects

  • No database operations are performed - this is a pure in-memory comparison with no performance impact
  • No Business Rules, ACLs, notifications, or other platform mechanisms are triggered by this comparison
  • Timezone conversion to UTC happens automatically and is cached within the GlideDateTime object for performance
  • Execution time is consistent regardless of script context (Business Rules, Script Includes, Scheduled Jobs)
  • No audit trail entries are created - the comparison operation is not logged anywhere in the platform
  • Memory usage is minimal as no new objects are created during the comparison process
⚠️

Equal timestamps return false - use equals() method if you need to test for chronological equality.