i want to use Python to create a new date format.
I have found something on the website:
datetime.datetime(2000, 12, 31)
!field1! + datetime.timedelta(days=100)
I want to try it with the both.
Does anybody know, where i should add it in the field calculator.
In the code block?
Sorry for my little informatic knowledge...
You could add it in the code block as a function, but it should work just fine in the normal window (just above the code block space).
You do already have a field where you're adding the 100 days to? I'm not sure what you mean by 'new date format', and what is the 31 Dec 2000 for?
If you just want to play with the module, use an IDE or online compiler such as Online Python Compiler (Interpreter) (programiz.com)
then try things such as:
import datetime initial_datetime = datetime.datetime(2000, 12, 31) time_delta = datetime.timedelta(days=100) print(initial_datetime) print(initial_datetime + time_delta)
my mean Problem starts by the default time setting in ArcGIS.
If i import my netCDF than the date is imported incorrect such as double. If i create a new field in a date format, the date begins just as by default 1899 and not like my original 2019.
So i want to calculate a new field to get to my original date which is 2019-01-01 to 2020-12-31.
That 31.Dec 2000 was just an example...
you should just be able to specify an exact date for all the rows in the correct format, such as
However I can't really comment on NetCDF as I believe the temporal dimension is stored differently.
Hopefully there's some examples with the Make NetCDF Raster Layer tool and the dimension parameter.
the thing is I choose from a satellite website some Data in netCDF Format. An I set the beginning of my time period on 2019-01-01. But instead of that it is shown up as a double value like you can see in the picture with a red border. And i want to have it like 2019-01-01. I uploaded a picture with my Problem.
If your time column is "days" then read on
d = datetime.datetime(2019, 1, 1) # your initial date at the top d datetime.datetime(2019, 1, 1, 0, 0) time_vals = [46, 47, 48, 49] # -- using some of the values I saw in the "time" column # ---- now pretend this is a field calculation # ---- look at the output, this is what would appear as you go down the column for val in time_vals: new_date = d + datetime.timedelta(days = val) print(new_date) 2019-02-16 00:00:00 2019-02-17 00:00:00 2019-02-18 00:00:00 2019-02-19 00:00:00
I think the field calculator expression would be
datetime.datetime(2019, 1, 1) + datetime.timedelta(days = !time!)
many thanks for your effort.
That is also an options to calculat an field, but I think I found my solution for my multidimensional data.
I would ask you to check my solution.
I found my solution in the link on the page of ArcGIS...
So i create a Variable Field, a Dimension Field with "StdTime". Now there is also a little Problem with understanding Python...
I uploaded a picture with a red mark, which doesnt fit to my date I think...if i put this inside the Code Block and click ok, its written there something with invalid parameter? So the date should retrieved but how which syntax?