Released erajp that displays date time in Japanese calendar format in Python

Let's display the Japanese calendar in Python! I thought. For example, 2015. I especially want to display my birthday in the Japanese calendar.

When I looked it up, it seems that there is locale.ERA in the standard, but if it is Japan or something like strfprint, it will be displayed as H27! It says, but I can't find anything that corresponds to the strfprint format.

So, I wondered what happened to other languages, and when I looked up Ruby, era_ja was convenient.

On the other hand, it seems that there is no Python version, so I thought I would make it, and I made erajp. (I felt that Japanese was ja and Japan was jp, so I chose jp)

https://github.com/recruit-mtl/erajp

Well, it's not a big deal to do, and I was able to refer to era_ja a lot.

I wrote a test using nose on Travis CI, made it work, displayed coverage using Coveralls, registered it on PyPI and installed it with pip, and so on. Was funny.

By the way, you can use it like this.

>>> strjpftime()
 'H27.08.05' # now
>>> strjpftime(datetime.datetime(1989, 1, 8)) 
 'H1.01.08'
>>> strjpftime(datetime.datetime(1989, 1, 8), u"%O%Year E")
 '1989'

Recommended Posts

Released erajp that displays date time in Japanese calendar format in Python
Determine the date and time format in Python and convert to Unixtime
Get date and time in specified format
format in python
The one that displays the progress bar in Python
To represent date, time, time, and seconds in Python
Convert timezoned date and time to Unixtime in Python2.7
Convert date timezone (time difference) in Python (from string)
Date manipulation in Python
Image format in Python
Get date in Python
Date calculation in python
Japanese output in Python
Find this week's date in any format with python
Date calculation in Python
Loop through a generator that returns a date iterator in Python
Get the current date and time in Python, considering the time difference
Easily format JSON in Python
I wrote python in Japanese
String date manipulation in Python
I understand Python in Japanese!
Sort by date in python
Get Japanese synonyms in Python
[Python / Django] Create a web API that responds in JSON format
A function that measures the processing time of a method in python
Automatically format Python code in Vim
Handle NetCDF format data in Python
Handle GDS II format in Python
Measure function execution time in Python
Code tests around time in Python
How to handle Japanese in Python
How to get the date and time difference in seconds with python
[IOS] I made a widget that displays Qiita trends in Pythonista3. [Python]
How to stop a program in python until a specific date and time