Skip to main content
Solved

Charvar to Date format


imageI have CSV file in the character format with a value as shown here. I would like to change it into Date format so I will be able to date calculation later. I tried to use Dateformater. it did not work. is there any other transformer that I can leverage to accomplish this?

Best answer by ebygomm

kris_ab wrote:

I just wonder should I have Date field before using dateformatter transformer? I want to change varchar to Date.

You don't need anything but the DateTimeConverter, e.g. using the csv you posted

image

View original
Did this help you find an answer to your question?

10 replies

redgeographics
Celebrity
Forum|alt.badge.img+49

Which parameters did you use in the DateFormatter?


  • Author
  • May 6, 2023
redgeographics wrote:

Which parameters did you use in the DateFormatter?

Hello Redgeographics Thank you for your time.

 

Since my existing date is month day and year in string format, I used default to let FME or ISO to find the input parameter. Also I did not find m%d%y% format in the dropdown list. the output format I used default and %Y%m%d. The transfer ran successfully but the outcome filed was still sting in Sep 2, 2022. No changed literally. A little doubt about the datetime attribute, there was cor_date field and also @value(cor_date). I tried both. not sure of the difference between them.

imageAlternatively, I created the separate Date field and copy all information from occ_date to date field. The date field was no value.


redgeographics
Celebrity
Forum|alt.badge.img+49

The thing with the DateTimeConverter is that if the format you have (or want) is not in the dropdown list you can add the format string yourself. So "Sep 2, 2022" is %b %e, %Y (3-letter month 1- or 2-digit day, 4-digit year


  • Author
  • May 8, 2023

Hi, I changed input and output format as %b %e, %Y, but the workbench ran successfully. The field also changed to Date format, but the values were null. All dates values were not carried over.


ebygomm
Influencer
Forum|alt.badge.img+32
  • Influencer
  • May 8, 2023

The input format in your screenshot and your sample csv file are different, can you confirm which is correct?

 

So for your screenshot it would be

%b %e, %Y

But for your csv example file the input format would be

%e-%b-%y2099

 

 


  • Author
  • May 8, 2023
ebygomm wrote:

The input format in your screenshot and your sample csv file are different, can you confirm which is correct?

 

So for your screenshot it would be

%b %e, %Y

But for your csv example file the input format would be

%e-%b-%y2099

 

 

I just wonder should I have Date field before using dateformatter transformer? I want to change varchar to Date.


ebygomm
Influencer
Forum|alt.badge.img+32
  • Influencer
  • Best Answer
  • May 9, 2023
kris_ab wrote:

I just wonder should I have Date field before using dateformatter transformer? I want to change varchar to Date.

You don't need anything but the DateTimeConverter, e.g. using the csv you posted

image


  • Author
  • May 9, 2023
kris_ab wrote:

I just wonder should I have Date field before using dateformatter transformer? I want to change varchar to Date.

thank you very much


  • Author
  • May 9, 2023
kris_ab wrote:

I just wonder should I have Date field before using dateformatter transformer? I want to change varchar to Date.

Hello Ebygomm, the resultant table is as follows: the date field still looks. varchar. I was expecting this field Date, wasn't I?

 

imageimage


ebygomm
Influencer
Forum|alt.badge.img+32
  • Influencer
  • May 10, 2023
kris_ab wrote:

I just wonder should I have Date field before using dateformatter transformer? I want to change varchar to Date.

To write out as a date you will need to change attribute definition to manual and change the type to date


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings