Link to home
Start Free TrialLog in
Avatar of Sean Girgis
Sean Girgis

asked on

Perl How to parse a string containing fraction second to a DateTime Object

"Search Time": "2017-05-08 15:03:20.561",

my $t = Time::Piece->strptime($searchTime, "%Y-%m-%d %H:%M:%S");

I get an error saying
garbage at end of string in strptime: .124 at C:/Perl64/lib/Time/Piece.pm line 481

I am using ActivePerl in Windows. There are packages that I could not install like Time-modules. Actually, I am having so many issues with new packages to install. I need a solution that might not require specific packages as I can get stuck.

perl -v

This is perl 5, version 24, subversion 1 (v5.24.1) built for MSWin32-x64-multi-thread
(with 1 registered patch, see perl -V for more detail)

Copyright 1987-2017, Larry Wall
ASKER CERTIFIED SOLUTION
Avatar of wilcoxon
wilcoxon
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial