Skip to content

Instantly share code, notes, and snippets.

@exodist
Created January 24, 2018 22:40
Show Gist options
  • Save exodist/78eccc407df1ff62ca044169878d9508 to your computer and use it in GitHub Desktop.
Save exodist/78eccc407df1ff62ca044169878d9508 to your computer and use it in GitHub Desktop.
fix a stamp for postgres
sub format_stamp {
my $stamp = shift;
return undef unless $stamp;
my $out = DateTime->from_epoch(epoch => $stamp)->stringify;
$out .= $1 if sprintf("%.10f", $stamp) =~ m/(\.\d+)$/;
return $out;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment