Skip to main content

Hi FME community,

I am still fairly new to FME. I'm getting stuck with date/time fields in csvs and excel documents. I've attached the field I'm trying to convert into DD/MM/YYYY HH:MM (%d/%m/%Y %h:%m ?), but it writes out empty if I try the DateConverter or AttributeManager> Text editor > DateTimeFormat. It's likely I'm using the transformers incorrectly. Is anyone able to point me in the right direction?

Hi epro,

Firstly ensuring the CSV reader separatesimage the columns, confirming the delimiter type in the parameter's

 

So 15/08/2022 10:59:52 a.m. appears to be a custom "Input" format. Expanding the quick reference and using the Preview to see if we have the correct syntax and

image soon find that perhaps the a.m. and p.m. needs a stringreplacer before the Dateconverter?

imageanother string replacer for the pm...

run to the last string replacer and inspect the new date field valuesimageInput format

%d/%m/%Y %H:%M:%S %p

15/08/2022 10:59:52 am

 

 

 


@epro_admin​ Thanks for including a small sample dataset - that makes it much easier to test a solution.

Just for completeness... The CSV reader has the capability to parse data/time fields, it's buried in the reader parameters:

imageBut... in this case it won't help since there is no way around the 'a.m.' or 'p.m.' format, so you have to use the approach described by @jamesb16otterill​ 


Thank you both for your replies!


Reply