I'm working with two data sets that require a compound key to join or relate.
The two fields are:
- 'Node_ID' which is a long integer field referring to a particular electrical substation 
- 'Date_ID' which is a date field and refers to a specific time stamp. [1/13/2014 9:00:00 AM]
Since ArcGIS doesn't allow for compound joins I'm left to improvise. The solution that I would like to use is to combine these two fields into a single field. I'm thinking that a text field may be easiest but a long integer may be better for performance (this is a large amount of data) (also I'm not 100% confident that text can be indexed).
The question that I have is: How would I convert an ArcGIS date field to a numeric (or text) representation?
This is the part that's stumping me. I'm fairly well versed in Python but once I start mixing ArcGIS datatypes things get a bit confusing.
To get you started here are some resources:
Converting string or numeric time values into date format (This is the inverse of what I want to do) Best practices for storing temporal data (Note: my reputation isn't high enough to post more than 2 links)
Also, there is a pure python function that allows this conversion to happen easily. Its methods in the datetime module. Here is a quick example:
>>>import datetime >>>current_datetime = datetime.datetime.now() # Current system time >>>print(current_datetime.strftime('%m/%d/%Y %H:%M:%S') >>>'01/11/2015 09:38:22'
Once in this format, I can easily manipulate it to create the join-able field that I need.