Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want to define a custom locale with my own calendar settings. In this locale, we set a specified year as the first year. For example, if I define a en_UNIX.UTF-8, I'd like to set AD 1970 as year 1, and AD 1970 as year 2.

Is there any way to do this in Linux/BSD? I looked into system's locale files and found they only defined the first day of week, currency and so on except the first year of calendar...

share|improve this question
up vote 0 down vote accepted

Use of the gregorian calendar is hard-coded in glibc:

So anything that uses the C library ("system") routines - gmtime_r, localtime_r and so on - to convert between seconds-since-the-epoch and broken-down-date format, will stick to the "standard" calendar (365 days in a year, Gregorian leap-year formula, 7 days per week...).

For code you write yourself, you could use the ICU Project's libraries and provide your own non-Gergorian calendar specification in the Unicode Common Locale Data Repository XML format.

I'm pretty sure you don't want to do that.

share|improve this answer
I found many GNOME applications are depends on libicu, is there anyway to set non-Gergorian calender for these applications? – Lingfeng Xiong Apr 25 '13 at 12:29
@LingfengXiong Not usefully, because libicu is probably mostly used to deal with unicode character set and font handling for internationalisation, not for date handling. It may be used for that, but there's not much of a way to find out: you'd need to find/create a suitable calendar definition, make sure it's installed/available, set your timezone to that one, and see if it makes a difference. And even if it does, it might not in all places in the code, and if it doesn't, perhaps that build simply can't or won't load it without a recompile, but would. – Gabe Apr 25 '13 at 16:27
thanks for your kindly help :-) Does Mac OS X (GUI applications) and FreeBSD handle this kind of things in the same way? – Lingfeng Xiong Apr 26 '13 at 9:43
The situation on FreeBSD is essentially identical to Linux; I have absolutely no idea what support MacOS provides for time/date handling beyond basic Unix routines, and to what extent you can expect it to be used. – Gabe Apr 26 '13 at 12:19

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .