Select to view content in your preferred language

Year only in a date field

9693
16
04-17-2019 10:57 AM
JoeBorgione
MVP Emeritus

I have a feature class with a numeric field representing a year in the form of yyyy (2017).  ArcGIS Pro has a tool called Convert Time Field that can take an integer and write it to an existing date field or it will add one for you.

When I run the tool it returns a date in the form of 1/1/2017.  Is there a way to format a date field to show just the year?

That should just about do it....
0 Kudos
16 Replies
Robert_LeClair
Esri Notable Contributor

If you added a new text field and calc'ed that field to have the year only?  Would that work?

0 Kudos
DanPatterson_Retired
MVP Emeritus

You missed my "Funky" link above.  Apparently a text or numeric is not needed, but a Date field with just the year... cool results though

0 Kudos
Robert_LeClair
Esri Notable Contributor

I did - cool "funky" link though!

0 Kudos
JoeBorgione
MVP Emeritus

Probably; this is a project wrought with bad data, so any additional fields are just a band-aid at best.  My colleague found something on github that he's working through.  We are seeing more and more non-data types who want data-intensive analyses.  Not a great combination. (Can't you just hit cntrl F3 and make my spreadsheet a bomb-proof database?)

That should just about do it....
0 Kudos
AlexZhuk
Frequent Contributor

I think there is a misunderstanding between the core properties of the Date, Text, and Integer types. Or it's just my misunderstanding?

0 Kudos
JoeBorgione
MVP Emeritus

Not really a misunderstanding per se, just wondered if it's possible some how.  I guess it's not and as mentioned earlier, this red herring is back into the sea......

That should just about do it....
0 Kudos
by Anonymous User
Not applicable

Some of my favorite problems to have: 1) writing code for rotational corrections brought over from legacy CAD files 2) commingling scalar & vector "man behind the curtain" magic to represent velocity arrows at the requested scale that originates at a fixed point, and 3) Dealing with date conversion for client display. Just kidding, all of that gives me a headache but date management is something you have to start managing the expectations of your users (and boss) on and start looking for stronger typed  solutions that offer better management of date & time with built-in functions for your chosen flavor of RDBMS. If you don't have options on those fronts, DatePart is a handy function to gain familiarity with for popping the date into a text field. Big picture advice - educate yourself on date field manipulation because it's worth getting your head around.