Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Add non-US-format dates to Mail Apps
I've been irritated by the fact that Mail seems to ignore my personal date settings as defined in the International section of System Preferences. In fact, rather than respecting the system setting (bad Apple!), it tries to guess it based on the system language.

Unfortunately, this means that English uses the US date format, which is annoying and confusing for those of us who use other formats.

Well, fear not, and gripe no more. Delving into the contents of Mail (control-click on Mail in Applications, then choose "Show Package Contents"), you can find the localization resources and modify them to suit. The relevant file is Contents -> Resources -> English.lproj -> Localizable.strings. Editing this (I suggest a backup beforehand) and searching for "date" will bring you to the appropriate section.

There are many fields to cope with all the different ways in which Mail displays the date as you adjust the column; you'll need to change all of them! The date specifiers are as follows:
Year
%y  two digit year (03)
%Y  four digit year (2003)

Month
%b  short month name (Nov)
%B  long month name (November)
%m  month number with leading zero

Day
%e  day without leading zero (1)
%d  day with leading zero (01)
Read the rest of the hint for my version of the file...

My modified file displays dates in ISO YYYY-MM-DD format (deteriorating to YY-MM-DD when the field gets too narrow). I have left the long, wordy date in its original state.

/* Date format with arguments full month, day, and year, to be
   followed by time */
"FULL_DATE_AND_TIME_FORMAT" = "%B %e, %Y  ";

/* Date format for today, to be followed by time */
"TODAY_FORMAT" = "Today  ";

/* Date format for yesterday, to be followed by time */
"YESTERDAY_FORMAT" = "Yesterday  ";

/* Date format with arguments abbreviated month name, day, and year,
   to be followed by time */
"ABBREV_DATE_AND_TIME_FORMAT" = "%b %e, %Y  ";

/* Date format with arguments abbreviated month name, day, and year,
   to be followed by time */
"ABBREV_DATE_SHORT_YEAR_AND_TIME_FORMAT" = "%b %e, %y  ";

/* Date format with arguments year, month number, and day [2003-12-01],
   to be followed by time */
"NUMERIC_DATE_AND_TIME_FORMAT" = "%Y-%m-%d  ";

/* Date format with arguments year, month number, and day [03-12-01],
   to be followed by time */
"NUMERIC_DATE_SHORT_YEAR_AND_TIME_FORMAT" = "%y-%m-%d  ";

/* The format for hours and minutes in 12 hour format */
"12HOUR_TIME_FORMAT" = "%1I:%M";

/* The format for hours and minutes in 24 hour format */
"24HOUR_TIME_FORMAT" = "%H:%M";

/* Argument is the AM/PM designator */
"AMPM_DESIGNATOR_FORMAT" = "%p";

/* Date format with arguments full month name, day, and year */
"FULL_DATE_FORMAT" = "%B %e, %Y";

/* Date format for today */
"TODAY_NO_TIME_FORMAT" = "Today";

/* Date format for yesterday */
"YESTERDAY_NO_TIME_FORMAT" = "Yesterday";

/* Date format with arguments abbreviated month name, day,
   and year */
"ABBREV_DATE_FORMAT" = "%b %e, %Y";

/* Date format with arguments year, month number, and day
   [2003-12-01] */
"NUMERIC_DATE_FORMAT" = "%Y-%m-%d";

/* Date format with arguments year, month number, and day
   [03-12-01] */
"NUMERIC_DATE_SHORT_YEAR_FORMAT" = "%y-%m-%d";
[robg adds: I inserted returns into some of the comment lines to narrow the display width.]
    •    
  • Currently 2.00 / 5
  You rated: 5 / 5 (4 votes cast)
 
[7,194 views]  

Add non-US-format dates to Mail | 9 comments | Create New Account
Click here to return to the 'Add non-US-format dates to Mail' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Add non-US-format dates to Mail
Authored by: kailb on Jun 24, '03 01:20:31PM

In addition, you can also remove the relative date by changing...

/* Date format for today, to be followed by time */
"TODAY_FORMAT" = "Today ";

/* Date format for yesterday, to be followed by time */
"YESTERDAY_FORMAT" = "Yesterday ";

to something like...

/* Date format for today, to be followed by time */
"TODAY_FORMAT" = "%b %e, %Y ";

/* Date format for yesterday, to be followed by time */
"YESTERDAY_FORMAT" = "%b %e, %Y ";

It's static and won't re-size with the column width, but you can match whatever view format you are using.

Does anyone know the data specifier to add a leading zero to the 12 hour format?



[ Reply to This | # ]
Add non-US-format dates to Mail
Authored by: ThreeDayMonk on Jun 24, '03 05:53:22PM

It's %H for 24-hour hour, and %1I (the "1" ensures it's at least one digit wide, presumably) for 12-hour, judging by the file, although I haven't tried that. It ought to work. The 12/24-hour setting seems to be one area where it does respect the international settings, by the way.



[ Reply to This | # ]
Add non-US-format dates to Mail
Authored by: kailb on Jun 24, '03 07:15:55PM

I was trying to find the specifier for the leading zero in the 12 hour display. I saw that the regular spcifier was:

/* The format for hours and minutes in 12 hour format */
"12HOUR_TIME_FORMAT" = "%1I:%M";

It looks like the "1" is actually the blank space holder. Because if you remove it and use:

"12HOUR_TIME_FORMAT" = "%I:%M";

you will get a leading zero where the blank space was.





[ Reply to This | # ]
Add non-US-format dates to Mail
Authored by: kailb on Jun 24, '03 07:35:17PM

So to further add to your specifier list...

Year
%y two digit year (03)
%Y four digit year (2003)

Month
%b short month name (Nov)
%B long month name (November)
%m month number with leading zero

Day
%e day without leading zero (1)
%d day with leading zero (01)

Time
%1H hour (24) without leading zero ( 9:31)
%H hour (24) with leading zero (09:31)

%1I hour (12) without leading zero ( 9:31)
%I hour (12) with leading zero (09:31)



[ Reply to This | # ]
Add non-US-format dates to Mail
Authored by: techren on Jun 25, '03 12:04:10PM

According to the strftime manual:

%I is replaced by the hour (12-hour clock) as a decimal number (01-12).

%l is replaced by the hour (12-hour clock) as a decimal number (1-12); single digits are preceded by a blank.

Seem to work for me; but except for this test, I use the ISO formats. And I like the metric system. :)



[ Reply to This | # ]
12/24 H display in Mail
Authored by: hamarkus on Jun 24, '03 06:38:58PM

Thanks a lot for that hint.

My Mail was reversing for about a year now the 12/24 H settings, when the system settings were 24h it would display in 12h style, and vice versa, although the menu bar clock correctly obeyed to what was set in the system settings.
The only way around was, to quit Mail, switch to 12h in the system settings, restart Mail, which would then display the time in the 24h style, go to system settings switch back to 24h in order to get the menu bar clock back to 24h. Unfortunately, every restart of Mail or even puttting the computer to sleep made Mail to refresh its settings and displaying in the 12h style while the system setting was set to 24h. BTW, the overall setting was German, i.e. 24h.

With the help of your hint, I just switched the descriptions in my localizable.strings file, they now look as follows:

/* The format for hours and minutes in 12 hour format */
"12HOUR_TIME_FORMAT" = "%H:%M";

/* The format for hours and minutes in 24 hour format */
"24HOUR_TIME_FORMAT" = "%1I:%M";

So, my overall system settings are set to 24h, Mail reads that to be 12h (for whatever reason), looks up how to display the time, but now in the 12HOUR line the format of the 24h style is found, and Mail takes that, and I am happy.

P.S.: I'm using project builder to modify these kind of files, anybody any ideas, whether it matters, whether I use windows, mac or unix file endings for these kind of system files, and what file encodings (UTF, etc.) I should use. I'm already changing back the permissions (i.e. owner back to system).



[ Reply to This | # ]
file format
Authored by: ThreeDayMonk on Jun 25, '03 12:10:40AM

They are (at least in the case of Mail) UTF-16, with Unix-style line endings. If you open the file in Project Builder, you can find the information under the Format menu (Line Endings and File Encodings).



[ Reply to This | # ]
Change location settings too?
Authored by: robm on Jun 25, '03 06:30:35AM
When I reply to a mail, this English-centric operating system quotes as a location something like (this in Dutch):
XX heeft op dinsdag, 24 jun 2003 om 23:45 (Europe/Amsterdam) het volgende geschreven:
Now what I'd really like to change is Europe into Europa. Just to be more in synch with my native language and because I find Europa actually prettier than Europe. Anyone any idea on how to accomplish this?

[ Reply to This | # ]
Add non-US-format dates to Mail
Authored by: tcv on Apr 02, '04 07:44:03PM

This doesn't seem to work in Panther. :-(

Why? Well, the localizable.strings file does NOT contain the section necessary to adjust these settings.

I. Am. Sad.

m



[ Reply to This | # ]