locked
Formatting time using AddHours RRS feed

  • Question

  • User-453926175 posted

    I'm trying to post when the last time user logged in based on who is viewing the records current time zone, but I'm getting an error.

    So @lastlogin.Submitted is the last time the user logged into the system

    @firm.TImeZoneValue is the offset of the person viewing the records timezone.  So for example it could return -6 for the mid west.

    @lastLogin.Submitted.AddHours(@firm.TimeZoneValue).ToString("h:mm tt - MMM dd, yyyy")

    This is the error I'm getting...

    The best overloaded method match for 'System.DateTime.AddHours(double)' has some invalid arguments

    Tuesday, April 12, 2016 10:17 PM

Answers

  • User1853794821 posted

    Not being privy to your code and to the data types of the variables involved, my suspicion is that "@firm.TimeZoneValue" is some datatype other than double.

    The DateTime.AddHours() method requlres a value of type double.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, April 12, 2016 11:25 PM

All replies

  • User1853794821 posted

    Not being privy to your code and to the data types of the variables involved, my suspicion is that "@firm.TimeZoneValue" is some datatype other than double.

    The DateTime.AddHours() method requlres a value of type double.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, April 12, 2016 11:25 PM
  • User-453926175 posted

    Yes, I had to change it to a float.

    Thanks.
    JBishop

    Wednesday, April 13, 2016 2:26 AM