Forum Discussion
- QuickBaseCoachDQrew CaptainYou would create a New Table called perhaps User Time Zones with a Key field of userid and a field for the hours offset as a numeric field.
- QuickBaseCoachDQrew CaptainI assume that you know that you can set the app to a particular Time Zone for all users, but you are saying that you are in a different time zone from most of the rest of the users.
You would need to have a table of users with a key field of userid and their time zone offset from the time zone that the app is set for. Then a relationship to any other tables in the app where you want to show local time and have a calculated field which calculates the Now() value or any other date/.time field such as [Date created] and add hours according to the offset.
The right side of the relationship will need to be a formula user field typically called [Current User] with a formula of User()
for example
[Date Created] + Hours([offset hours]) - Raymond_MarlonTQrew TraineeWhere can I create a table of users? And how should I do it?
- CarlosCarlosQrew Assistant CaptainIs there a way to get the current date/time (on a button and then to a field) when the user hasn't refreshed the page in a couple of hours? (Attempting to track time dedicated to work, so they open a record when they start to work on a given task, but they consistently fail to refresh before closing it (using a button) so it stores the date/time of the last page refresh, instead of the current time.
- MichaelBarrowQrew CadetYeah, very frustrating! I would love an answer to this, as it makes my time sheet app much more difficult to use for my end users. Is there some clever javascript that can be added to a button to overcome this?
- CarlosCarlosQrew Assistant CaptainMichael, I think i just got it.! (there are references to someone else's code here... cannot remember who or where. If anyone feels they should be credited, please say so!)
Formula URL Button:"javascript:" &
"var QBU_key = '" & [Record ID#] & "';" &
"$.getScript(gReqAppDBID + '?a=dbpage&pagename=STOPACTIVITY.js');" &
"void(0);"
Then the JS File (STOPACTIVITY.js):var apptoken = "type_the_apptoken_here";
$.ajaxSetup({data: {apptoken: apptoken}});
//this one prompts the user for an input describing what he'd been doing...
var motive = prompt("In this activity I was doing: ");
//this is the basic setup for the date. TimeZone for US timeZones and format you may change es-CR to en-US and the timeZone to America/New_York, etc. hour12:true will display in 12 hour format. False will display as 24h.
var event = new Date(Date.now());
date = event.toLocaleString('es-CR', { timeZone: 'America/Costa_Rica', hour12:true} );
if(motive == null){
alert("No task description was input. No changes were performed.");
record
}else {
var promise = $.get(gReqDBID,{
act: "API_EditRecord",
rid: QBU_key,
_fid_12: motive,
_fid
_fid_57: date
});
alert("Activity Ended.");
location.reload();
} - MichaelBarrowQrew CadetThank you! I will give this a try when I get back in the office._