Skip to content

Instantly share code, notes, and snippets.

@sunaku
Forked from mikz/gist:574015
Created September 10, 2010 17:58
Show Gist options
  • Save sunaku/574080 to your computer and use it in GitHub Desktop.
Save sunaku/574080 to your computer and use it in GitHub Desktop.
def quoted_date(value)
base = value.respond_to?(:getutc) ? value.getutc.to_s(:db) : super
usec = sprintf(".%06d", value.usec) if value.respond_to?(:usec)
zone = " #{value.formatted_offset}" if value.respond_to?(:formatted_offset)
"#{base}#{usec}#{zone}"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment