East Asia Student

Random Stuff Related to East Asia


Chinese time format for coding: %Y年%m月%e日 %A %I:%M %p

Just a quick post on a Chinese time format for outputting the date and time in Chinese. Various programming languages let you construct date and time formats using a standard syntax (strftime, from C).

I always find myself resetting the time and date format to Chinese for the clock in Cinnamon / GNOME, so I thought I’d make a quick note of this Chinese strftime date formatting:

%Y年%m月%e日 %A %I:%M %p

As long as your system language is Chinese and it correctly interprets the formats using Chinese, you’ll get a Chinese date and time like this:

2013年07月18日 星期四 10:27 上午

Normally I’d prefer 24 hour time, but I think I might as well get a couple more hanzi in my day by setting it to 12 hour and adding 上午 / 下午 afterwards. You can of course play around with the above to make any sort of date / time you like. This is a good resource for it.

Chinese time format

Contact me: mhg@eastasiastudent.net


By the way, I'm a freelance software developer -- contact me about your software development project.