Date Formats Question

0
Hi, I am trying to write an appscript that will query the ts_user table, and I need to use the ts_lastlogindate. However the date is stored as a number in the table. Anyone have any idea how I can convert this so I can use it please? Many thanks, Lisa
Responses (5)
  • Accepted Answer

    Tuesday, October 09 2018, 01:22 PM - #Permalink
    0
    What version of SBM are you using? ModScript has been updated to work well with dates.
    The reply is currently minimized Show
  • Accepted Answer

    Tuesday, October 09 2018, 05:34 PM - #Permalink
    0
    The last login date is stored as Epoch time - which is the number of seconds since 01/01/1970. I am not sure if there is a function in AppScript or ModScript to easily convert to a readable format. In SQL, there is DATEADD.

    One thing to be aware of is that the time stored in the database will be based on GMT, so you may also need to consider including in your calculation the number of hours before/after GMT for the location of the server to see the 'local' time when someone logged in.
    The reply is currently minimized Show
  • Accepted Answer

    Tuesday, October 09 2018, 05:46 PM - #Permalink
    0
    Please refer to the Extension function help in the AppScript and ModScript documents on Ext.DbLongToDate. I think this will address your concern.
    Like
    The reply is currently minimized Show
  • Accepted Answer

    Tuesday, October 09 2018, 06:29 PM - #Permalink
    0
    Thanks, Garry, I forgot about that.
    The reply is currently minimized Show
  • Accepted Answer

    Wednesday, October 10 2018, 02:35 AM - #Permalink
    0
    Many thanks for the responses guys. I ended up using DATEADD as I eventually figured out it was epoch time.
    The reply is currently minimized Show
Your Reply

Recent Tweets