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.
Row Info
Row Number 20
TableName: *
FieldName: DateUpdate
ValueInfo: DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")
ValueMethod: EXPRESSION
On Create: 1
On Change: 1
Checking for Subtype Restriction
Field Name: DateUpdate was found at index: 68
Trying: EXPRESSION
Checking to verify there is a field to store the expression
Expression to be eval: DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")
ERROR: evaluating the expression for feature in Brevard_Nena_Street with OID of 42394
Object required: 'DateTime'
Finished: EXPRESSION
Using your value info through the debugger, I get a proper date and the process completes
>? args[0]
"yyyy-MM-dd HH:mm:ss"
>? DateTime.Now.ToString(args[0])
"2017-02-07 14:08:04"
What version are you using? I would suggest trying out the preview of the next release
https://github.com/Esri/local-government-desktop-addins/tree/dev/PreviewBuilds
Also, you need a string field as the date/time field will display the date based on your system date time formatting.
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
Michael thanks for the help. What I will end up doing is create a DATE field and a TIME field and then write an expression for my DateUpdate field looking like this: [DATE] & "T" & [TIME] & "-05:00"