Skip to content

Instantly share code, notes, and snippets.

@kristopherjohnson
Last active September 13, 2022 14:54
Show Gist options
  • Save kristopherjohnson/d2d5709b7ddd94dff15bbee0f753853e to your computer and use it in GitHub Desktop.
Save kristopherjohnson/d2d5709b7ddd94dff15bbee0f753853e to your computer and use it in GitHub Desktop.
Ruby: Generate a timestamp string
# Return 'YYYY-MM-DD HH:MM:SS' string for current time, using local timezone.
def timestamp()
Time.now.strftime '%Y-%m-%d %H:%M:%S'
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment