Skip to main content
Question

How can i convert date from dd.mm.yy to yyyy (4 digit only ) in column in excel

  • January 30, 2020
  • 12 replies
  • 81 views

soly
Contributor
Forum|alt.badge.img+3
  • Contributor
  • 70 replies

How can i convert date from dd.mm.yy to yyyy (4 digit only ) in column in excel

 

as example 01.02.2000 to 2000 only

Thanks

This post is closed to further activity.
It may be an old question, an answered question, an implemented idea, or a notification-only post.
Please check post dates before relying on any information in a question or answer.
For follow-up or related questions, please post a new question or idea.
If there is a genuine update to be made, please contact us and request that the post is reopened.

12 replies

erik_jan
Contributor
Forum|alt.badge.img+22
  • Contributor
  • 2179 replies
  • January 30, 2020

Have a look at the DateTimeConverter transformer.


umapper1
Contributor
Forum|alt.badge.img+5
  • Contributor
  • 41 replies
  • January 31, 2020

Could you not also use a text string function to strip the preceding characters, retaining just the last 4 digits?


soly
Contributor
Forum|alt.badge.img+3
  • Author
  • Contributor
  • 70 replies
  • January 31, 2020

Have a look at the DateTimeConverter transformer.

 

 

 

i found the problem ,it reads last examination as char but it is in column date as 20.06.2019

do you have suggestion to convert from char to date .

i tried to convert char type to date type manual of the reader but it does not work also but i need a way to do that automatically in correct way bcs all my excel files have the same issues .thanks


soly
Contributor
Forum|alt.badge.img+3
  • Author
  • Contributor
  • 70 replies
  • January 31, 2020

Could you not also use a text string function to strip the preceding characters, retaining just the last 4 digits?

what u mean about string function ,i do not have transformer in fme 2018 for that .thanks

i think ,this is my problem bcs i did another column called date ,it shows that type is date and i get output but old colzumn that what i need last examination ,the type is char so i did not get any output.i need to convert from char type to date automatically .thanks


Forum|alt.badge.img+2
  • 1891 replies
  • January 31, 2020

@soly DateTimeCOnverter should work. Try an input format string of %d.%m.%Y$


erik_jan
Contributor
Forum|alt.badge.img+22
  • Contributor
  • 2179 replies
  • January 31, 2020

Have a look at the DateTimeConverter transformer.

If it is a Char where the year is always the last 4 characters, the SubstringExtractor transformer (from -4 to -1) will result in getting the year.


soly
Contributor
Forum|alt.badge.img+3
  • Author
  • Contributor
  • 70 replies
  • January 31, 2020

If it is a Char where the year is always the last 4 characters, the SubstringExtractor transformer (from -4 to -1) will result in getting the year.

thansk for reply i got ur idea but i checked the output on inspector and it is the same as input no change

input excel file

 

i choose source string the column that i need

 

outüut inspector is still the same ,

do u have another solution or what do u think which wrong or do we have way to convert tye attribute .thanks

 

 

 

 


soly
Contributor
Forum|alt.badge.img+3
  • Author
  • Contributor
  • 70 replies
  • January 31, 2020

@soly DateTimeCOnverter should work. Try an input format string of %d.%m.%Y$

thanks but i did it and it does not work with me

 

could you provide me an example of work space if u have time but make the input as char for date and thanks i need only the last 4 digit only the year


erik_jan
Contributor
Forum|alt.badge.img+22
  • Contributor
  • 2179 replies
  • January 31, 2020

thansk for reply i got ur idea but i checked the output on inspector and it is the same as input no change

input excel file

 

i choose source string the column that i need

 

outüut inspector is still the same ,

do u have another solution or what do u think which wrong or do we have way to convert tye attribute .thanks

 

 

 

 

End index should be -1 instead of 1


soly
Contributor
Forum|alt.badge.img+3
  • Author
  • Contributor
  • 70 replies
  • January 31, 2020

End index should be -1 instead of 1

m.xlsx

 

please this is the excel file.could u try by ur self and let me know,how can i convert last column that include char .i know ur idea by substring,it should be correct but it does not work with me .i do not know the reason and i changed the index and it does not work .thanks for helping


erik_jan
Contributor
Forum|alt.badge.img+22
  • Contributor
  • 2179 replies
  • January 31, 2020

m.xlsx

 

please this is the excel file.could u try by ur self and let me know,how can i convert last column that include char .i know ur idea by substring,it should be correct but it does not work with me .i do not know the reason and i changed the index and it does not work .thanks for helping

Here is the solution:

And the workspace:

Date_to_Year.fmw

Hope this helps.


soly
Contributor
Forum|alt.badge.img+3
  • Author
  • Contributor
  • 70 replies
  • February 2, 2020

Here is the solution:

And the workspace:

Date_to_Year.fmw

Hope this helps.

thanks alot