HOW TO
Individual portions in a Date field of a feature class or shapefile, such as year, month, day, hour, minute, or second, can be extracted using the DatePart() VB function in the Field Calculator.
Note: Note that only the date portion (yyyy/mm/d) is supported in shapefile attributes, therefore, no time information (hh:mm:ss) can be extracted from a shapefile Date field.
Note: Support for Visual Basic for Applications (VBA) for ArcMap and ArcCatalog ended with the ArcGIS 10.2.2 release, and Esri has not included VBA compatibility setups since version 10.5. Refer to ArcGIS Desktop and VBA Moving Forward for more information.
DatePart("PART", [DATEFIELD])
Note: The PART argument can be one of the following keywords: yyyy (YEAR), m (MONTH), d (DAY), h (HOUR), n (MINUTE), or s (SECOND), and it must be enclosed with double quotation marks.
Article ID:000014933
Get help from ArcGIS experts
Download the Esri Support App