DateField before eval: 20190402000000
I'm trying to apply strftime/strptime so the DateField will show as 2019-04-02
| eval DateField=strftime(strptime('DateField',"%Y%m%d"), "%F")
This eval produces 2019-04-20 instead of 2019-04-02. I thought %d included a leading zero, but it's not showing in my date. Where did I go wrong?
I believe additional zeros in your timestamp are causing issue. Ideally, your strptime time format should include all characters appearing in your DateField, that way every character is properly processes. Give this a try (runanywhere sample, look for time format in DateField2)
| gentimes start=-1 | eval DateField="20190402000000" | table DateField | eval DateField1=strftime(strptime('DateField',"%Y%m%d"), "%F")| eval DateField2=strftime(strptime('DateField',"%Y%m%d000000"), "%F")