Welcome to the SRP Forum! Please refer to the SRP Forum FAQ post if you have any questions regarding how the forum works.

Date Time

Need another pair of eyes please.
As part of a web service I've been recording the last date.time each user requested data so I can force a timeout if the user has been idle for x amount of time.
Seems straight forward.
For each request I've been recording in a datetime field.
Firstly I retrieve the decimal value of time via
TimeDecimal = Mod(Time(), 86400)
and then just store it in the field like so
userrec<last_login$> = Date():".":TimeDecimal

Thought this was working just nicely but what I've since found is that what is actually being saved to the record is

date().time()

The decimal value of time is not being saved but the actual time() function value ie how many seconds after midnight which is not how datetime fields work.
I only write to this field in one place so I'm pretty sure I'm not overwriting it anywhere else so any thoughts on what I'm missing?

Comments

  • The formula you are using is equivalent to time() because it gives you the remainder of 86400, which is essentially the seconds since midnight. You need to divide the time by 86400.


  • Funny how your pair of eyes saw the same thing my pair of eyes saw yesterday and then overlooked this morning when I went to fix it.

    This morning my head went back to "Mod()", oh that means the bit after the decimal point
  • edited March 2018
    No problem. I've had more than my share of myopia. Another pair of eyes always helps.
Sign In or Register to comment.