cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Single digit month as an option in DateTime.toString()

Single digit month as an option in DateTime.toString()

Can we please have single-digit month option (1-12) added as one of the formatting options for DateTime.toString() that would be analogous to %e? According to the documentation, the current options are:

month-options-for-datetime-tostring.png

%m returns a double digit version, i.e. April -> 04.

 

The current workaround would be to construct the month number as a separate string that would then be concatenated with the rest of date string, which is not the prettiest solution:

DateTime ts = Model.dateTime;
string month_str = string.fromNum(ts.month);
string date_str = month_str + "/" + ts.toString("%e/%Y");

Can't find what you're looking for? Ask the community or share your knowledge.

Submit Idea