senooken JP Social
  • FAQ
  • Login
senooken JP Socialはsenookenの専用分散SNSです。
  • Public

    • Public
    • Network
    • Groups
    • Popular
    • People

Conversation

Notices

  1. zunda ? nはおまけ :green_dango: (zundan@mastodon.zunda.ninja@mastodon.zunda.ninja)'s status on Thursday, 17-Jan-2019 15:56:47 JST zunda ? nはおまけ :green_dango: zunda ? nはおまけ :green_dango:

    Single UNIX Specificationではstrftime (daetコマンド)の書式指定にEを加えると年号に変換してくれることが有名です。ほら!

    $ LC_TIME=ja_JP.UTF-8 date +%EY
    2019

    あれれ?ちょっと調べてみるとロケールを生成しておく必要があることがわかりました。

    $ sudo locale-gen ja_JP.UTF-8

    $ LC_TIME=ja_JP.UTF-8 date +%EY
    平成31年

    他にも日本語的な書式が使えました。

    $ LC_TIME=ja_JP.UTF-8 date +%c
    2019年01月16日 20時41分42秒
    $ LC_TIME=ja_JP.UTF-8 date +%Ex
    平成31年01月16日

    元号はlocalesパッケージに定義されているようです。glibcのtar ballだとlocaledata/locales/ja_JP。

    $ dpkg -S /usr/share/i18n/locales/ja_JP
    locales: /usr/share/i18n/locales/ja_JP

    2019年4月1日以降にglibcの更新、ビルドとパッケージの更新が必要なようです。

    In conversation Thursday, 17-Jan-2019 15:56:47 JST from mastodon.zunda.ninja permalink

    Feeds

    • Activity Streams
    • RSS 2.0
    • Atom
    • Help
    • About
    • FAQ
    • TOS
    • Privacy
    • Source
    • Version
    • Contact

    senooken JP Social is a social network, courtesy of senooken. It runs on GNU social, version 2.0.2-beta0, available under the GNU Affero General Public License.

    Creative Commons Attribution 3.0 All senooken JP Social content and data are available under the Creative Commons Attribution 3.0 license.