Calculating Date in report
Hello! I have a report that uses a data field for a date. The date is reported correctly with the identify tool on the map. However, when you generate a report the time is wrong. It is 5 hours ahead of the time on the map. I am guessing this is because the DataField in the report is reporting the time in UTC. How can I convert the UTC time to EST? I have been exploring using a calculated field using the convert time method from VB.net but am having no luck. Any suggestions? Thanks!
0
-
Hi Clarence,
Using the following for the datafeild in the report should cover up for the 5 hour gap that you are getiing.
=System.DateTime.Now.AddHours(-5).ToString()
Thanks0 -
Thanks Preet!
I used =fieldname.AddHours(-5).ToString() and that worked. I appreciate your help! I was caught up on the fact that I needed to convert the field and not simply add hours. Thanks again.0 -
Hi Clarence,
If EST is your local time, then it is good practice to let the date convert automatically instead of hardcoding the difference hours. I would suggest you to use the following instead:
Date.FromFileTimeUtc(131339420213329925).ToLocalTime().ToString()
Here 131339420213329925 are your ticks in UTC.
By doing this, regardless of which zone you are opening your application, the date will be converted automatically.
Regards,
Mohammad Ashraf0
Du måste logga in om du vill lämna en kommentar.
Kommentarer
3 kommentarer