Skip to content

Instantly share code, notes, and snippets.

@aquaductape
Last active August 22, 2023 22:49
Show Gist options
  • Save aquaductape/1eb46dfbaf6c9879b19a8e4b38c58d2e to your computer and use it in GitHub Desktop.
Save aquaductape/1eb46dfbaf6c9879b19a8e4b38c58d2e to your computer and use it in GitHub Desktop.
how to get produce timestamp like rails
# how to get produce timestamp like rails
#
# ActiveRecord::Schema[7.0].define(version: 2023_03_19_164906) do
# create_table "articles", force: :cascade do |t|
# t.datetime "created_at", null: false
# t.datetime "updated_at", null: false
# end
# end
# `%6N` is microsecond ( 6 digits )
p Time.now.strftime("%Y-%m-%d %H:%M:%S.%6N")
# "2023-03-28 00:04:10.054370"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment