Select to view content in your preferred language

Labelling by Year from Date Field

5271
6
03-21-2012 06:06 AM
LindseyMitchener
Emerging Contributor
I need to label using only the year from the date field.  How do I do this?  Thanks!
I am using ArcView 9.3.
Tags (2)
0 Kudos
6 Replies
KenBuja
MVP Esteemed Contributor
You can use this syntax where DATE_ is your date field:

DatePart("yyyy",[Date_])
UrosDjuric
Deactivated User
You can use this syntax where DATE_ is your date field: 

DatePart("yyyy",[Date_])


Ken Buja is absolutely right ... 🙂

Right click on shape file in Table of contents, than Labels Tab, than Text string > Button Expression than field Expression and copy-paste code from kenbuja in text box, and replace DATE_ with your data field name. (This is for ArcGis 10, but I assume that is same for previous 9.x versions, as I can remember ...)
0 Kudos
DianeMcConnaughey
Deactivated User
I am getting a Invalid procedure call/aargument using "DatePart"   in the Field Calculator ArcGIS 10 SP3 XP  FileGeodataBase Feature
DatePart("dd",  [Date_Observed]).  Date_Observed is a date field.  The field I am calculating is text, long, date - I've tried all.  I also tried DatePart("d",  [Date_Observed]).  I have used this successfully in 9.3.1.  Any other options ?  Anyone now the python equivalent??
0 Kudos
DarrenWiens2
MVP Honored Contributor
DatePart ("d", [date] ) works for me, calculating a text field from a date field. Maybe double check that the date field is actually a date field, and not text disguised as a date...?
0 Kudos
FredMcDoddle
Emerging Contributor
how do you do this but show it like this:
dd/mm/yyyy
e.g. 31/01/2013

thanks
0 Kudos
FredMcDoddle
Emerging Contributor
Actually, I worked out a way. There might be a better way but this works:

 DatePart("d", [Sampled_Date_Time] )  & "/"  & DatePart("m", [Sampled_Date_Time] ) & "/"  & DatePart("yyyy", [Sampled_Date_Time] ) 


see also:

http://msdn.microsoft.com/en-us/library/ms174420.aspx

:cool:
0 Kudos