Customizing the SHORT time format?

by Michael S. Kaplan, published on 2005/12/18 03:01 -05:00, original URI:

Long time reader of this blog Ivan Petrov asked in the Suggestion Box:

Hi Michael.

From where can I customize the Short Time Format?

The Long Time Format can be Customized from Regional and Language Options > Customize (button)=>Customize Regional Options > Time (tab), but the Short one?


Ivan has an excellent point. The .NET Framework has its DateTimeFormatInfo class with its LongTimePattern and ShortTimePattern, but Regional Options does not have anything like it.

So where is the short time pattern, and why is it not in Regional Options?

Well, to start, Regional Options has the job of supporting all of the fields in the Win32 locales that can be overridden. And functions like Win32's GetLocaleInfo only has a LOCALE_STIME, which matches the data in the .NET LongTimePattern. Win32 has never had such a concept.

Which of course leads us to wonder where .NET got the idea from.

The important thing to remember is that while to many .NET is the successor to Win32, it is more accurate to consider .NET to be the successor to COM and the VB/VBA world. Now VBA supports a FormatDateTime function that accepts a vbShortTime, but that has never been a Win32 locale functionality.

There are probably people who will be reminded of the limitations in percent functionality I have discussed previously, and indeed the issue is similar -- the need to be compatible with a feature that was written by somebody else and for which there has not been a real push to understand the globalization scenarios is never going to get the same kind of support as one that has.

With that said, the .NET ShortTimePattern is a settable property, so one could always override it. And obviously one could even cleverly remove the AM/PM indicator if it exists in the long time format if one needed to.

As an interesting data point, often when customers have mentioned this issue in the past, they expect that the time pattern in Regional Options would affect both the long and short time patterns in the .NET Framework, which is a fascinating idea (though if it were up to me I would add a LOCALE_SSHORTTIME before I'd put Win32 or Regional Options into the string parsing game). And since it has come up as a point of confusion when people compare/contrast the managed and unmanaged worlds, it is probably on people's radar at this point.

But for now, the short time is something that is only in the COM and .NET worlds, while traditional Win32 only has the long time, which it simply calls the time.


This post brought to you by "𝄵" (U+1d135, a.k.a. MUSICAL SYMBOL CUT TIME)

# Ivan Petrov on 20 Dec 2005 3:46 PM:

Hi Michael.

Thank You for the professional answer.

I'm just curious, would some day/is somebody planning to be added a drop-down box on the Time tab in

Customize Regional Options, for customizing the SHORT time format? ... because if we take for example the

Date tab, there we can customize both the Short date and the Long date format! I think that it's logically

in the Time tab the things to be the same! ...
... Another interesting idea is to be added a tab named (for instance) 'Calendar', in which the user can

customize the Short and Long names of the Months and/or the Weekdays, the Calendar type ...
... Also there're some other elements from a Locale, which can be added to the existing tabs in Customize

Regional Options to be customizible, like: in the Currency tab - the Native currency name, the English

currency name, the International currency symbol and so on ... ; I think that Customize Regional Options

must be revised from that viewpoint - the viewpoint as many things as possible to be customized! I think the

users would like it ;-) ...
... And here is a very interesting idea of mine ;-). Yesterday, I have opened the Customize Regional Options

window and was looking it as always and then in my mind comes the following idea:
Custom Regional Options SCHEMES (profiles): That means that the user can save/load Custom Regional Options

in/from files. I think that this is idea with great potential!


# Michael S. Kaplan on 20 Dec 2005 4:08 PM:

Hello Ivan,

Actually, you will want to be looking into custom cultures (which become custom locales n Vista) to have that level of customization, as it is not really feasible to expand Regional Options in the way you are indicating....

# Ivan Petrov on 20 Dec 2005 4:56 PM:

Ok Michael, but I really think that the user must have the possibility to customize the SHORT time format through Customize Regional Options window!
So would some day/is somebody planning to be added that future?


# Michael S. Kaplan on 20 Dec 2005 5:28 PM:

I can forward on the feedback. Like I said, we are not really invested as heavily in these things that other people did since it usually did not involve the same amount of homework that we do on features....

Since most applications will not use it (more unmanaged than managed) and thus most users will never see the results of the change, it might be more confusing to add it.

Most importantly, since the majority of users never even lunch our UI at all (let alone the customization UI), the number if people who actually meet all the criteria for this to be useful would likely all fit in the same minivan (with room left over for a cooler to hold the beer!).

# Ivan Petrov on 20 Dec 2005 5:49 PM:

Ok, but I think I'm right and I'm writing you about this 'SHORT time format' issue, because I think that this future must be in Customize Regional Options and because I think everybody in Microsoft think that Vista must be better than every released Windows version! As I know, there is great enthusiasm inside Microsoft this thing to happen! ;-)


# Ivan Petrov on 24 Dec 2005 1:42 PM:

Hi Michael.

Merry Christmas!

My question was inspired by this:

If we open an instance of Windows Explorer, and then we choose Details from the Views menu, then we see Name, Size, Type and Date Modified columns. The 'Date Modified' column displays the Date (in SHORT Date format) and the Time (in SHORT Time format) when the Folder or the File was Modified. So, my wish is to Customize SHORT Time format in that manner to be displayed like I want in the 'Date Modified' column in Windows Explorer, or if you want - the Time in the system tray (which is again in SHORT Time format).


# Michael S. Kaplan on 24 Dec 2005 3:06 PM:

Hello Ivan,

Merry Christmas to you, and happy holidays and so on....

You are mistaken on both points -- both use the LONG TIME, or as we knoe it in Windows, THE TIME. The Short Time you see has absolutely nothing to do with anything in Windows. If you want to customize times in Windows, then it is STIMEFORMAT that you mudt modify.

Sorry, but the only argument in your favor on this one is the one you already mentioned. :-)

# Ivan Petrov on 24 Dec 2005 4:20 PM:

Hello Michael.

Thank you for the quick answer.

It seems you're right again ;-)

I want to explain you a little bit more about what I want to do and what bothers me:

Thne main idea is to customize the Windows time format in conformity with Bulgarian national standard fo time formating. So I make the following steps:
Regional and Language Options > Customize (button)=>Customize Regional Options > Time (tab),
then in the time format dropdown box I'm typing the following:

HH:mm:ss 'ч.'

where "ч." is abbreviation from 'часа' which means 'hour', which is near by sense the English "o'clock". Anyway, to this point everything goes ok!After clicking 2 time OK we have the new user defined Time format. And it's working! For example if I right click on a file in Windows Explorer and choose 'Properties' from the shortcut menu, then in the General tab in the Properties window all the times (Created, Modified, Accessed) are displayed correctly, exactly I want! For example:

25 Ноември 2005 г., 22:12:04 ч.

But, in Windows Explorer with Details switchen on from the Views menu, in the 'Date Modified' column for the same file we can see the following:

25 Ноември 2005 г., 22:12

And here is the problem. I want to see this 'ч.' after the time, but I can't ;-(
I expect to see the following:

25 Ноември 2005 г., 22:12 ч.

Please, provide some guidelines what to do to make this happen!

Best wishes,

# Michael S. Kaplan on 24 Dec 2005 4:48 PM:

In Windows and the .NET Framework both, the application always has the last say in what will show up. In this case it looks like Explorer is making a choice that is based more on the fact that there are no AP/PM markers than the literal format.

So what happens if you put that 'ч.' in for the AM/PM markers and a 't' in the long time format? When I do that, I think I get exactly what you are looking for here....

# Ivan Petrov on 24 Dec 2005 5:12 PM:

Ahaaaa, thank you Michael.
Milion thanks!

This is my Christmas gift from GIFT (I mean you Michael ;-) )

I'm very happy now ;-)

See you.


Please consider a donation to keep this archive running, maintained and free of advertising.
Donate €20 or more to receive an offline copy of the whole archive including all images.

referenced by

2010/01/27 We do seem to be short on time... (Windows 7 edition)

2008/10/19 I see LONG TIME and SHORT TIME; where are SHORTER TIME and SHORTEST TIME?

2007/11/02 Predictably (in retrospect), aka Where Wild^H^H^Hindows-Only Things Are, aka SHORT [on ]TIME for a LONG TIME

2006/10/15 Compatibility is inconsistent; consistency is not compatible...

2006/07/21 We do seem to be short on time...

go to newer or older post, or back to index or month or day