I want to parse the string time but it results runtime error
import times
var parsedTime = parse("2017-05-24 10:33:54", "yyyy-MM-dd' 'HH:mm:ss")
Error
Traceback (most recent call last)
parsingtime.nim(3) parsingtime
times.nim(952) parse
times.nim(751) parseToken
strutils.nim parseInt
Error: unhandled exception: invalid integer: 0: [ValueError]
What is the correct way to parse time?
Thanks for suggestion.
I noticed that's for posix platform, I prefer platform agnostic which times provided but I'll use strptime if there's no other way.
My Nim version
> nim -v
Nim Compiler Version 0.17.0 (2017-05-18) [Windows: amd64]
Copyright (c) 2006-2017 by Andreas Rumpf
git hash: d3f0f87e81e262ee25fd528aae5b6db0bdf78d5e
active boot switches: -d:release
I'm running Windows 10 64bit. Using Linux Subsystem yield same result but that version is 0.16.0
Running on Ubuntu 16.04 64 bit returns the same error too, the Nim version is 0.17.0
Found the mistake facepalm
I looked why the char value fed to parseInt was off for one, then I realized I put additional space in layout string. sigh