Hello,
Please help me how to convert DD.MM.YYYY stored as Text format to YYYY/MM/DD as Date format using ArcGIS Pro Calculate Field?
Hi, the Convert Time Field geoprocessing tool is another option.
You have to set the time zone for your layer since it defaults to GMT. Your time zone is seven hours off.
Hi @TimOrmsby
Thank you for the solution. With this geoprocessing tool I don't need to run a script.
This is the result:
Hi @KenBuja ,
Thank you for your response, I also try your script:
if(IsEmpty($feature.DateText)) { return null } var date_split = Split($feature.datetext, ".") return Date( date_split[2], date_split[1] - 1, date_split[0])
and give me this result:
Hi @JohannesLindner ,
Thank you for your response. I have tried the arcade script & get this result.
Python:
# expression f(!DTFIELD!) # code block - assuming "yyyy.mm.dd" def f(dt): try: d = dt.split(".") return datetime.datetime(int(d[2]), int(d[0], int(d[1]) except: return None
ArcGIS Pro Help: Calculate Field Python Examples - Dates
Please note that this will give you an incorrect date, since the Month value in the Date function is 0-based. Use this instead.
EDIT: Updated the code. I forgot that the Date function uses a zero based month. Thanks, @KenBuja !
Date Functions | ArcGIS Arcade
To convert your strings to dates: calculate date field, switch to Arcade
if(IsEmpty($feature.DateText)) { return null } var date_split = Split($feature.DateText, ".") return Date(date_split[2], date_split[1] - 1, date_split[0])
To change how the date is displayed in the table:
https://pro.arcgis.com/en/pro-app/latest/help/data/tables/format-numeric-and-date-fields.htm
サインインしたメンバーは投稿、更新のフォローなどができます。初めてですか?無料アカウントを登録してください。
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.