Date and Time Field Calculations in Arcmap

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
welcome back to nrm 435 GIS analysis at the University of Alaska Fairbanks in this session we're going to work with a special field type called the date/time field which allows us to store dates so month day year and time so hours minutes and seconds so let's start by creating four points that we can work with so the first thing I'll do is I'll use the create fishnet tool and we'll create a square and then we'll get the four corner points that Square is composed of so we use create fishnet I'll go into this test time geodatabase and it'll be a polygon and it will be one row one column so once Square and ten wide ten high and I'll just start at zero zero and I'll go straight north so zero and then any y value that's greater than zero but that creates our square so then what we want to do is get the corner points the square is composed of so if we search for vertices here's the tool that will allow us to get the corner points so we'll use the feature vertices two points tool and we'll output to the same geodatabase test time and we'll name our output corner points so if we look at the table there's actually five points so we have our beginning point which is the lower left-hand corner and then our ending point which is also the lower left-hand corner so we can add a special type field the date field that can contain dates and times to any table so let's add that date time field to our corner points attribute table and then the type is date so if we're in a geodatabase this field can contain dates so day month year and it can contain time so hours minutes seconds if you go to a folder in a shapefile it can only contain dates it can not also contain time at the same field so we're in a geo database so we can put the day the month the year the hour the minute and the second for each point so we can use the field calculator and there's special functions that we can use with date/time fields so for example we'll fill in our test date/time field with whatever now is so now is our current computer day month year hours minutes seconds so that fills in our current time let's say that we want to change a date for this last point let's say it's on the 27th of February not the 26th so we can use the field calculator and enclosed in double quotes so we would have our date the hour the minutes and then second and then this is in the morning so what I change here is it's not the 26th it will be the 27th and I also change the minutes instead of 10 I changed it to 20 we can also use the date add function where we can add to time so for example we can use the object ID and we'll add that let's add that as a second to each time so the flag for second is going to be s for seconds so we're gonna add a second based on this field and we'll add it to our output field test date time so right now everything's at 10:30 for seconds and then it converts to 1035 seconds so two seconds all the way up to five seconds added we can use negative values to subtract so let's subtract by one minute so these values of 10 will subtract by 1 minute so it would be negative object ID M is month so we use n as a flag so we use a flag n 4 minutes and it's subtracted from each value whatever this was in minutes the flag H is for hour so let's change this to hours H and let's add one hour each field so it adds one hour two hours three hours four hours five hours let's add a day to each field we had one day added two days added three days added all the way up to five days added and let's add a month to each field the M is a flag per month so we added one month to five months to our original field and let's add a year to each field so the flag for a year is four wise all lower case let's go back and I'm so negative negative one year and negative five years so we go back in time we can also extract parts of our date/time field and put them in a short integer field so let me add a field and we'll just call this part so we can use the date part function so we'll use the same flags to get parts of our date/time field so for example give us seconds enclosed in double quotes from our eighth pine field so then it extracts the seconds and let's do the same thing let's get the minutes so lower case in minutes and we get minutes and let's extract the hours so H for hours and we'll extract a Saudi for day and the month so M for month so lower case M a month and then extract the year the four wise extracts the year okay the other thing we could extract is what is the day of year so for example January 31st would be day of year 31 February 1 would be day of year 32 so to do that we would use one y so that extracts the day of the year then we have the date of the year and we can use the flag W will give us the day of the week where a1 is Sunday a - is Monday etc so for example March 27 2017 the day of the week was 2 so that would be Sunday is one Monday is 2 so that would be in Monday and we could also ask for what is the week of the year two w's so for example March 27th was the 13th week of the year August 4th was the 32nd week of the year and we can use the date difference function to get the difference so for example how many days is it between this date in February 27th 2018 so we would use the flag for E and then the field containing the date and then the date we want to subtract from so in this case it was 336 days between March 27th 2017 and February 26 2018 another example how many years will it be between these dates and 2020 so we'll change the flag two years and then our date will make it January 1 2020 so it's three years from 2017 to 2020 and it's seven years between 2013 and 2020
Info
Channel: GIS Analysis NRM435 University of Alaska Fairbanks
Views: 7,082
Rating: 5 out of 5
Keywords: arcmap field calculator, arcmap date time, arcgis date field, arcmap temporal data
Id: 7GOOxkoSbSM
Channel Id: undefined
Length: 10min 27sec (627 seconds)
Published: Wed Feb 28 2018
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.