Truncate date field

548
2
Jump to solution
01-14-2013 02:26 PM
ruchibhutani
New Contributor
Hello

I have an annexation layer that has Annex_Date field in mm/dd/yyyy format. I am trying to extract just the yyyy part. I have added a new field called Annexation_Year, and I am trying to calculate the records. I have tried to use DatePart and DateYear function for VBScript without any success. Any other suugestions on how this can be handled?

Thanks,
Ruchi Bhutani
GIS Analyst
0 Kudos
1 Solution

Accepted Solutions
JakeSkinner
Esri Esteemed Contributor
Hi Ruchi,

You can do this using Python and the field calculator.  Here is the syntax:

!Annex_Date![-4:]


Also, be sure 'Python' is checked at the top of the Field Calculator.

[ATTACH=CONFIG]20728[/ATTACH]

View solution in original post

0 Kudos
2 Replies
JakeSkinner
Esri Esteemed Contributor
Hi Ruchi,

You can do this using Python and the field calculator.  Here is the syntax:

!Annex_Date![-4:]


Also, be sure 'Python' is checked at the top of the Field Calculator.

[ATTACH=CONFIG]20728[/ATTACH]
0 Kudos
ruchibhutani
New Contributor
Thanks Jake...
0 Kudos