Quantcast
Channel: Forums - ArcObjects SDKs
Viewing all articles
Browse latest Browse all 1374

Formating field values

$
0
0
I'm trying to create a feature class with a number of fields, and I've got the data to load properly. However; I'd like to format the Date field so that the ArcMAP (Identify) always displays the date and time when selected in ArcMAP. Is there a way to specify the formatting for a specific field value?

Here's what I've got thus far... (I'd like for it to always display as YYYYMMDD HH:mm:SS UTC instead of the default of 12:00:00 AM)

Code:

       
public static IFeatureClass createFeatureClassWithSR(string fcn, IFeatureWorkspace fw, ISpatialReference sr, string filname) {
            IFeatureClassDescription fcDesc = new FeatureClassDescriptionClass();
            IObjectClassDescription objDesc = (IObjectClassDescription)fcDesc;
            IFields fields = objDesc.RequiredFields;
            IFieldsEdit fieldsEdit = (IFieldsEdit)fields;
            int shapeIdx = fields.FindField(fcDesc.ShapeFieldName);
            IField field = fields.get_Field(shapeIdx);

            IField f18 = new FieldClass();
            IFieldEdit f18Edit = (IFieldEdit)f18;
            f18Edit.Name_2 = "TOA";
            f18Edit.Type_2 = esriFieldType.esriFieldTypeDate;
            f18Edit.AliasName_2 = "TOA";
            f18Edit.IsNullable_2 = false;
            f18Edit.Editable_2 = false;
            DateTime d = new DateTime();
            f18Edit.DefaultValue_2 = d;
            fieldsEdit.AddField(f18);

Thanks

Viewing all articles
Browse latest Browse all 1374

Trending Articles