Skip to main content
Solved

I have an attribute in a .gdb containing dates in the format (yyyy) in a geodatabase in short integer which I need to change to an actual date attribute in the format (dd-mm-yyyy) with the date being january 1st for all. Is this possible? /Rasm

  • January 18, 2021
  • 4 replies
  • 149 views

Forum|alt.badge.img+1
I have an attribute in a .gdb containing dates in the format (yyyy) in a geodatabase in short integer which I need to change to an actual date attribute in the format (dd-mm-yyyy) with the date being january 1st for all. Is this possible? /Rasmus

Best answer by ebygomm

If you are writing back to a date field then you just need to create the dates in FME format (YYYYMMDD). So just append 0101 to the year and then write back to a date field. If you are writing to another format then you can append 0101 and then use a DateTimeConverter to get the desired format

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

4 replies

ebygomm
Influencer
Forum|alt.badge.img+32
  • Influencer
  • Best Answer
  • January 18, 2021

If you are writing back to a date field then you just need to create the dates in FME format (YYYYMMDD). So just append 0101 to the year and then write back to a date field. If you are writing to another format then you can append 0101 and then use a DateTimeConverter to get the desired format


Forum|alt.badge.img+1
  • Author
  • January 20, 2021

Hi, thank you very much for the response and sorry for the slow answer. I only had a chance to test it now.

 

Okay so now i am writing back into the date field with dates in the FME format (YYYYMMDD). When I try to run the workbench I get a fatal error saying: "An error occurred while attempting to convert the '' component of a date".

 

It is not clear to me if I should change it back into the format used in the GDB (DD-MM-YYYY) before writing it back to the GDB, so that i first create the dates, write them back into the date field in FME format, and then lastly change them back to gdb format before writing into the gdb.

 

I have tried both running with and without changing it back to the format used in the gdb but i get the same error.


ebygomm
Influencer
Forum|alt.badge.img+32
  • Influencer
  • January 20, 2021
rasmusraun wrote:

Hi, thank you very much for the response and sorry for the slow answer. I only had a chance to test it now.

 

Okay so now i am writing back into the date field with dates in the FME format (YYYYMMDD). When I try to run the workbench I get a fatal error saying: "An error occurred while attempting to convert the '' component of a date".

 

It is not clear to me if I should change it back into the format used in the GDB (DD-MM-YYYY) before writing it back to the GDB, so that i first create the dates, write them back into the date field in FME format, and then lastly change them back to gdb format before writing into the gdb.

 

I have tried both running with and without changing it back to the format used in the gdb but i get the same error.

Double check the value you are sending, you should be able to send a date in FME format

20210101 (8 digits)

or a date time

20210101000000 (14 digits)

and the writer will handle both those formats.

 

I can generate that error message if I send it, for example 9 digits (202101011) or 7 digits (2020011)

 

It will error if you attempt to send it a formatted date as in DD-MM-YYYY


Forum|alt.badge.img+1
  • Author
  • January 20, 2021

This solved it for me. A few rows had not been given a year and therefore had the wrong format.

 

Thanks!


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