Skip to main content

Calculating Date in report

Comments

3 comments

  • Preet Saini

    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()

     

    Thanks 
    0
  • Permanently deleted user
    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
  • Permanently deleted user
    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 Ashraf
    0

Please sign in to leave a comment.