Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I have dates in my attribute table that are stored as strings - they look like 02/22/2012 (mm/dd/yyyy) - and I would like to convert them to Date type. When I try to input a custom date format in the Convert Time Field geoprocessing tool it returns in all the records and I am not sure what I am doing wrong. I've tried MM/dd/yyyy and MMddyyyy - is there something I'm missing about setting up a custom date format? Or, is there another way I can do this?

share|improve this question
add comment

3 Answers

I created a shapefile with a string field with dates in the 02/22/2012 format and was able to convert it using the "Convert Time Field" tool after a couple tries. On my successful attempt I created a new field of type date and then ran the date conversion tool. For the custom format I used "MM/dd/yyyy". I also specified the newly created date field as the output time field. I checked the method with errors in the strings and even a string like "2/5/12" was converted to 2/5/2012. (My initial failures came because I assumed the tool would create a new date field for me, that didn't happen during my test.)

I hope this helps.

share|improve this answer
    
Thank you AtlasSteve - I tried this first (creating a new empty field with date type) and it appears to have worked! –  elCo Feb 16 '12 at 16:50
add comment

I just tested this and MM/dd/yyyy worked okay for me. Is it possible that there is a value in your string field that is not in this format? Maybe there are one or two records hiding in your string field with something like '2/22/2012' instead of '02/22/2012'.

share|improve this answer
1  
MM/dd/yyyy worked for me too - Cyrus' suggestion of checking your string field for rows that don't match the expected format seems sensible - could be worth testing on a table with just one or two rows if you have not already done so - and maybe "breaking" the format of a row to see what that does to the expected output –  PolyGeo Feb 10 '12 at 23:07
add comment

I have been able to do this using ArcGIS 10.2.

When I run the Convert Time Field tool on a GDB table of 20000 rows, it says it has completed successfully but no values are updated in the target field (nulls).

However, if I run it after first selecting all the records in the table (obviously you need to be in ArcMap to do this), then it updates the values as expected!

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.