https://issues.dlang.org/show_bug.cgi?id=21507

--- Comment #2 from anonymous4 <[email protected]> ---
You don't need to parse it, you can just append zeros:
---
string want(string time, int num)
{
        string tail=".000000000";
        time=time[0..$-1];
        if(num==0)return time[0..19];
        if(time.length>=20+num)return time[0..20+num];
        if(time.length>20) //1001-01-01T01:01:01Z
                return time~tail[$-(20+num-time.length)..$];
        return time~tail[0..num+1];
}
---

--

Reply via email to