Hey everybody,
I am trying to get my timestamp in a certain format: YYYY-MM-DDThh:mm:ss.s but I am not able to do it.
As an example it needs to look like this: 2017-02-20T23:16:45.7
Is this even possible? If so, what would be the expression I need?
Thanks,
Tim
Solved! Go to Solution.
Hold on, why are you using this in expression? Just use the TIMESTAMP value method and yyyy-MM-dd HH:mm:ss as the value info
Tim- after spending a little time with google I notice that t or T is often used to designate PM, but in a 24 hour clock, do you need to specify that? (2017-02-20T23:16:45.7) Tenths of a second seems pretty extreme; I haven't found a format for that yet.....
I know it is crazy, I am just looking through the upcoming NENA standards
This is what I am talking about:
1403 5.37 Date Updated 1404 Description: The UTC date and time that the record was created or last modified. This 1405 value SHOULD be populated upon modifications to attributes, geometry, or both. 1406 Domain: Restricted to ISO 8601 compliant values in Coordinated Universal Time (UTC). 1407 Values are not allowed to be in the future. 1408 Example: 2010-12-19T20:01:29-05 (representing a record updated on December 19, 2010 1409 at 8:01 and 29 seconds PM US Eastern Standard Time)
I often wonder about the practicality of NENA standards; I don't know what percentage I'm NENA compliant, but somehow we get the right truck or car to the right address in the shortest amount of time...
Looking at that document, I don't see tenths of a second. Currently I provide a date of when a record was last modified. ( I expect the NENA black Suburban to pull up any minute now and take me away.) Instead of AA, you could try using the Editor Tracker and specify UTC...
I pulled the decimal from their Date Field description:
D – Date and Time fields are as defined by the International Organization for Standardization (ISO) 8601 standard and are a NENA requirement. Date and time use ISO 8601 compliant formats which are in the format of YYYY-MM-DDThh:mm:ss.sTZD and conform to a TimeStamp as defined in NENA-STA-010 [1] , which in turn conforms to W3C dateTime format. Example: 2014-02-20T23:16:45.7-05:00 744 2014 = the Year 02 = the Month 20 = the Day NENA Standard for NG9-1-1 GIS Data Model NENA-STA-006.1-201X, Month Day, Year [MM/DD/YYYY] Page 29 of 86 23 = the Hour 16 = the Minute 45.7 = the Seconds and decimal fraction of seconds –05:00= the Offset from UTC Note: The Offset from Coordinated Universal Time (UTC) is the optional separator to indicate the time zone designation, which in this example is -5:00 to indicate the local Eastern Standard Time (EST) time difference from UTC.
I'll have to check out editor tracker!
We are using DateTime.Now.ToString<http://DateTime.Now.ToString>(format string) to set the date time. You just need to find the correct format string to specify in the value info. Make sure the field is a string you are storing the value in.
Hey mmiller-esristaff
thanks for the reply! So I would have to create the Field, in which I want the timestamp to go as a string field. Then I would use the Expression method for that field to fill in the timestamp?
Could you post a basic example of the DateTime.Now.ToString I would have to use? From there I can probably figure it out myself.
Thanks!
Tim
Tim- see of this helps: .net - DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss") is returning AM time instead of PM time? - Stack...
Joe, I tried that earlier but it didn't work. Maybe I was using it wrong? I even tried that in the field calculator and it didn't work. Thanks for posting though!
It will not work in the field calculator. Can you post what the aa debug/log file is reporting?