LoginSignup
1
0

More than 1 year has passed since last update.

Node-REDで今日の日付を日本語の表示形式で出す

Last updated at Posted at 2022-03-15

"2022年03月16日"という形式で日付を出力します。

スクリーンショット 2022-03-16 1.34.00.png

参考記事をもとにnode-red-contrib-momentを使ってみます。

参考: Node-REDで日時取得とデータ結合

Date/Time Formatterノード

こちらを使います。

スクリーンショット 2022-03-16 1.36.13.png

以下のように設定しました。

enebular上のデバッグだと+9時間にする必要がありました。
このあたりは実行するサーバー環境によって変わるかもしれません。

スクリーンショット 2022-03-16 1.36.49.png

Output FormatでYYYY年MM月DD日とすることで日

全体の流れ

Inject -> moment -> debugの流れです。

スクリーンショット 2022-03-16 1.39.49.png

Injectノードは日時を出力するようにしておきます。

スクリーンショット 2022-03-16 1.39.26.png

これでデバッグノードに日本語フォーマットで日付が表示されました。

スクリーンショット 2022-03-16 1.40.50.png

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0