0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

日付や時間を一瞬で入力する2つの方法

Posted at

ファイル名や記事に今のタイムスタンプを入力したいときに「2018/10/20」なんて手動で打つ必要はないです。

Google IME を使う

「きょう」と「いま」の変換で4種類ほど変換できます。

Fullscreen_2018_10_20_20_53.png

moment-cli を使う

もう少しカスタマイズしたフォーマットを使いたい人はこちら。

cpsubrian/node-moment-cli: CLI for printing dates via momentjs.

npm install -g moment-cli

使い方

$ moment -f "YYYY-MM-DD"
2018-10-20

$ moment -f "YYYY-MM-DD HH:mm:ss"
2018-10-20 20:59:35

$ # クリップボードにコピー
$ moment -f "YYYY-MM-DD HH:mm:ss" |pbcopy
$ alias -g C='| pbcopy'
$ moment -f "H時" C
0
1
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
0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?