How To: Copy dates from a number field to a string field
This article discusses how to use the Field Calculator to copy a date in 'yyyjj' format to a string field in 'MMddyy' format. Where 'yyy' is the year with century and 'jj' is the day of the year. For example, in 2000123, 2000 equals the year and 123 equals the 123rd elapsed day of the year.
- Open the table.
- Select Start Editing from the Table menu.
- Select Add Field from the Edit menu.
- In the Field Definition dialog box:
a. Set Name to an appropriate name, for example 'Date'.
b. Set Type to String.
c. Set Width to 6 or desired number and click OK.
- Make the date field active.
- Type the following in the expression text box on the Field Calculator dialog box.
Note: DateNumb is the name of the number field containing the 'yyyjj' date value.
Note: ArcView uses character codes to identify date and time components.Format dates by specifying how the year, month, and day appear. A date value plug is one of the following:
M - the month as an integer from 1 to 12 MM - same as 'M', two digits with leading zeros MMM - the short form of the month name MMMM - the long form of the month name d - the day of the month as an integer from 1 to 31 dd - same as 'd', two digits with leading zeros ddd - the short form of the day name dddd - the long form of the day name y - the year without century yy - same as 'y', two digits with leading zeros yyy - the year with century, four digits with leading zeros yyyy - same as 'yyy' yyyyy - the year with century, not restricted to four digits c - the century, without a leading zero cc - the century, with a leading zero for single digit centuries w - week of the year (Week 0 is first week with a Thursday) ww - week of the year, two digits with leading zeros D - numeric day of the week (Sunday = 1), one digit always AD - AD or BC string depending upon the year CE - CE or BCE string depending upon the year J - Julian Day (days since January 1, 4713 BC) j - day of the year jj - day of the year, three digits with leading zeros