in reply to JSON decode problem
#!/usr/bin/perl $str=' publish_date: new Date(1431654084199) ' ; $str =~ s/:\s*new Date\((\d+)\)\s*/&epoch2timestring($1)/ge; print $str . "\n"; sub epoch2timestring{ my ($e) = @_; $e=~s/.{3}$//; # eat 3 last digits my $result = scalar localtime($e); return ': "' . $result . '" '; # gmtime() ? }
prints:
publish_date: "Fri May 15 03:41:24 2015"
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: JSON decode problem
by kennethk (Abbot) on Aug 05, 2016 at 15:14 UTC | |
by FreeBeerReekingMonk (Deacon) on Aug 11, 2016 at 21:16 UTC | |
by kennethk (Abbot) on Aug 15, 2016 at 15:45 UTC |