Improvements to Date and DateTime parsing and formatting in Apex - Ideas - Salesforce Trailblazer Community
Trailblazer Community

All Ideas

Idea Details

Post an Idea
120  Points
Idea has been posted. Give it an upvote or downvote.

Improvements to Date and DateTime parsing and formatting in Apex

Development (Apex, LWC & VF)

Improve the handling of Date and DateTime values in code that exchanges these values with external systems over a text-based channel by making three changes:
  1. Add a `format()` method to the Date class, analogous to the method already extant on the DateTime class and accepting the same Java-sourced format string.
  2. Add a `parse(String format, String input)` method to both the Date and DateTime classes, accepting a Date or DateTime format string and a textual representation of the Date or DateTime to be parsed, which should be expected to be in the supplied format.
    1. Alternately, add a variant of the existing `Date.parse()` method allowing the caller to specify the locale, rather than being dependent on the user's locale.
  3. Ensure that the following invariant holds true when using implicit type conversion:
    String.valueOf(someDate) == '' + someDate


Merge Idea · Flag

  • Upvotes
  • Downvotes



from AppExchange


No results found.

Help us to keep IdeaExchange clean by pointing out overlapping ideas. We'll investigate your suggestion and merge the ideas if it makes sense.



Thanks for your merge suggestion. We will review it shortly and merge the ideas if applicable.

Salesforce takes abuse situations very seriously. Examples of abuse include but are not limited to posting of offensive language or fraudulent statements. To help us process your request as quickly as possible, please fill out the form below describing the situation. For privacy and security reasons, the final outcome of an abuse case may not be revealed to the person who reported it.


Thank you for your feedback. We take abuse seriously and will investigate this issue and take appropriate action.