Skip to main content
Solved

How to extract date and time from .json URL?

  • May 25, 2021
  • 2 replies
  • 80 views

Hi all,

 

I have a list of JSON historical file which contains date and time at the end of the URL. I would like to extract both date and time based on the URL and put it in the table.

 

I've extracted the date and time using the DateTimeStamper, but fails as it only generate current date and time.

 

Is there any suggestions on how can I extract the date and time from the URL?

Best answer by nielsgerrits

Multiple ways to do this. 

You can use StringReplacers to remove "http://apims.doe.gov.my/data/public_v2/caqm/" and ".json", then covert "2019/09/10/2300" the way you like it with a DateTimeConverter.

As an alternative for the StringReplacers you also can do it in one go using an AttributeCreator and

@ReplaceString(@ReplaceString(@Value(Url),"http://apims.doe.gov.my/data/public_v2/caqm/",""),".json","")

 

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.

2 replies

nielsgerrits
VIP
Forum|alt.badge.img+62
  • Best Answer
  • May 25, 2021

Multiple ways to do this. 

You can use StringReplacers to remove "http://apims.doe.gov.my/data/public_v2/caqm/" and ".json", then covert "2019/09/10/2300" the way you like it with a DateTimeConverter.

As an alternative for the StringReplacers you also can do it in one go using an AttributeCreator and

@ReplaceString(@ReplaceString(@Value(Url),"http://apims.doe.gov.my/data/public_v2/caqm/",""),".json","")

 


  • Author
  • May 27, 2021

Multiple ways to do this. 

You can use StringReplacers to remove "http://apims.doe.gov.my/data/public_v2/caqm/" and ".json", then covert "2019/09/10/2300" the way you like it with a DateTimeConverter.

As an alternative for the StringReplacers you also can do it in one go using an AttributeCreator and

@ReplaceString(@ReplaceString(@Value(Url),"http://apims.doe.gov.my/data/public_v2/caqm/",""),".json","")

 

Thank you @nielsgerrits​. It works!