Pulling day/month/year from datetime fields

2108
2
Jump to solution
09-11-2012 11:25 AM
BrittaSchroeder
New Contributor II
Please see my attached image. 
My original date field ("UTC_Time") contains thousands of unique datetime combinations and I want to have a field without the hhMMss time. I'm searching for a way to populate a field ("Day_Month_Year") to have a format similar to dd/mm/YYYY ("Flight_Date"). Since I want my attribute table to have fields with both date/time and just date, I don't want to change just the formatting of my OS. I was able to create a string field ("Flight_Date") but this doesn't serve my needs for further date calculations. Searching the Python tutorial, this is the best code I could conceive with my limited Python knowledge. I don't want to be that person who asks for someone to write my code, I would just appreciate being put on the right track. Thanks.
[ATTACH=CONFIG]17609[/ATTACH]
Tags (2)
0 Kudos
1 Solution

Accepted Solutions
JakeSkinner
Esri Esteemed Contributor
Hi Britta,

You can use the following calculation in the field calculator (be sure 'Python' is checked at the top).  This will work for a field of type Date.

!UTC_Time!.split(' ')[0]

View solution in original post

0 Kudos
2 Replies
JakeSkinner
Esri Esteemed Contributor
Hi Britta,

You can use the following calculation in the field calculator (be sure 'Python' is checked at the top).  This will work for a field of type Date.

!UTC_Time!.split(' ')[0]
0 Kudos
BrittaSchroeder
New Contributor II
Jake-
Thanks! Worked like a charm!
Britta
0 Kudos