The time in my gitlab's database is incorrect when I push one commit or create one merge request.
Then, from the GITLAB helps, it show that I need to update the time zone;
but when I update the /etc/gitlab/gitlab.rb from
#gitlab_rails['time_zone'] = 'UTC'
to
#gitlab_rails['time_zone'] = 'Asia/Shanghai'
and run
#gitlab-ctl reconfigure
#gitlab-ctl restart
it does not work, the time in database is still incorrect (8 hours later, I am in shanghai UTC+8).
How to update the time zone of gitlab?
Related
I have an AppleScript that runs on loop every two hours to modify a calendar B based on updates from another calendar A.
The script uses the on idle command below to wait 2 hours every loop. What happens if the computer stays idle for 1.5 hours then goes to sleep for 10 hours? Will there be 0.5 hours left when it wakes up? Any other scenarios?
on idle
my_code()
return (120 * minutes)
end idle
The script truly only needs to run if there is an update to calendar A, which is a shared iCloud calendar and can get updates from multiple people. The two hour loop is what I could figure out so far but I feel it is not efficient. Any more robust suggestions? Is there a way I can trigger the script to run only when it detects an update in calendar A? Or, along the same line of thought, is there a way to get the last timestamp the calendar was updated?
Thanks
I can't test following. Not sure it is the best way to solve your problem. Try yourself:
property oldStampDates : {}
on run
tell application "Calendar" to tell calendar "Test Calendar" to set oldStampDates to get stamp date of events
end run
on idle
--> Script retrieves last modified date and time of indicated calendar events.
tell application "Calendar" to tell calendar "Test Calendar" to set newStampDates to get stamp date of events
if newStampDates is not oldStampDates then display notification "The changes was detected"
set oldStampDates to newStampDates
return 30 -- seconds, default setting
end idle
NOTE: 1) you can put instead of display notification call to your handler my_code(), 2) you can put instead of 30 seconds other value, for example, return 10 (checking every 10 seconds).
I want to execute a Job in CRON for every 14 days from a specific date and timezone.
As an e.g. from JUNE 24TH every 14 days in CST time zone.
Run job every fortnight
The easy way
The easiest way to do this is simply to create the task to run every 14 days from when you want it to first run like:
CREATE TASK mytask_fortnightly
WAREHOUSE = general
SCHEDULE = '20160 MINUTE'
AS
SELECT 'Hello world'
How it works
As there are 60 minutes in an hour, 24 hours in a day and 14 days in a fortnight, ergo that's 20,160 minutes.
Caveat
The above solution does not run the task every fortnight from a given date/time, but rather every fortnight from when the task is created.
Even though this is the simplest method, it does require you to be nominally present to create the task at the exact desired next scheduled time.
As a workaround however, you can create a one-shot task to do that for you the very first time at the exact correct date/time. This means you don't have to remember to be awake / alert / present to do it manually yourself, and you can clean up the creation task afterwards.
The harder way.
Other solutions will require you to create a task which gets run every Thursday (since 2021-06-24 is/was a Thursday, each subsequent Thursday will either be the off-week, or the fortnight week)
e.g. SCHEDULE = 'USING CRON 0 0 * * THU'
Then you will add specific logic to it to determine which one the correct fortnight is.
Using this method will also incur execution cost for the off-week as well to determine if it's the correct week.
Javascript SP
In javascript you can determine if it's the correct week or not by subtracting the start date from the current date and if it's not a mutiple of 14 days, use this as a conditional to short circuit the SP.
const deltaMs = (new Date) - (new Date('2021-06-24'));
const deltaDays = ~~(deltaMs / 86400000);
const run = deltaDays % 14 === 0;
if (!run) return;
// ... continue to do what you want.
SQL
You can also check if it's a fortnight using the following SQL condition in a WHERE clause, or IFF / CASE functions.
DATEDIFF('day', '2021-06-24', CURRENT_DATE) % 14 = 0
I have UTC time zone set in my PostgreSQL and SELECT NOW() shows me the right date in psql console.
I use PHPStorm for development and its database console for accessing my database, but it uses different time zone (Europe/Moscow, which is the time zone of my Mac), and SELECT NOW() shows me the time in this time zone (and by the way, the date is wrong, because the Europe/Moscow time zone recently changed its offset to +3 from +4).
I have not found any information on how to tell PHPStorm to use the time zone configured in postgresql.conf instead of system's time zone. Is it possible?
verify your timezone with query
SELECT * FROM pg_timezone_names
now add phpstorm.vmoptions the config off timezone
-Duser.timezone=posix/America/Sao_Paulo
Apply changes, disconect, synchronize and verify whithselect now()
Well, I've found a solution, but it will affect every time-specific behavior in IDE, e.g. console logs will show datetime in UTC.
The idea is to pass a timezone to VM options. For that we need to modify a file and restart IDE.
For Mac OS X for the latest version of PHPStorm:
cp /Applications/PhpStorm.app/Contents/bin/phpstorm.vmoptions ~/Library/Preferences/PhpStorm2016.1/
Then add -Duser.timezone=UTC to the file, so that it looks something like that:
-Xms128m
-Xmx750m
-XX:MaxPermSize=350m
-XX:ReservedCodeCacheSize=240m
-XX:+UseCompressedOops
-Duser.timezone=UTC
After phpstorm.vmoptions file modification with -Duser.timezone=UTC line I've seen correct return only from NOW() function but incorrect from the queries to a table like SELECT timestamp FROM ...
Only adding a variable timezoneAsRegion with false value to Advanced tab of connection without any phpstorm.vmoptions changes helped me to return correct timezone from the table.
Documentation link: https://www.jetbrains.com/help/phpstorm/2016.1/data-sources-and-drivers-dialog.html#advancedTab
We have a scheduled job that runs on the 1st of each month with a Preferred Start Time of 1am. The job was scheduled using the Salesforce interface (Develop | Apex Classes | Schedule Apex). When it runs, it sets a month field for records based on the System date (System.today();). Occasionally, the month is set wrongly, and I suspect it's due to the date variable set to the System date.
If I set the job to run at 1am, logged in as my User (with a time-zone set to CDT), using the interface, what value would be returned by System.today()? Would the current CDT date be returned, or the GMT date?
Scheduled jobs run as "system", but I think there's still a user context, which means Date.today() or System.today() would be in CDT.
Update:
Just tested this and DateTime.now() returns GMT values.
Another update:
The docs say Date.today() returns the date in the current user's time zone. Based on the test below, the system knows who the user is, and it knows the user's time zone, so Date.today() would be the current date in the user's time zone. I confirmed this by setting my time zone to +10, and the system returned 2012-03-15 for the date.
// Brisbane +10 time zone
global void execute(SchedulableContext SC) {
System.debug(DateTime.now()); // 2012-03-14 19:24:39
System.debug(DateTime.now().formatLong()); // 3/15/2012 5:24:39 AM AEST
System.debug(Date.today()); // 2012-03-15 00:00:00
System.debug(UserInfo.getUserName()); // dev1#jeremyross.org
}
From the APEX dev guide:
The System.Schedule method uses the user's timezone for the basis of all schedules.
Hi
I am trying to change the Next Start of Schedule in DNN5.
I know it is possible to change the Time Lapse that would ultimately change the Next Start of the schedule.
But what i want do is to set the the schedule everyday at 12AM.
I could do it with 'Run Now' at 12AM and set the Time Lapse to '1 day', so that the system would set the Next Run everyday at 12. But it seems impratical to run it at 12AM.
Is there any other way to change the time of the Next Run?
Should I change it right in the databse: dnn_ScheduleHistory?
After having a look around at the scheduler, yes i think the only way to save you doing the run now, would be to manually add / update the record in the Schedulehistory table
Post on the dnn forum confimring there is not currently a way to run things at a specificed time
http://www.dotnetnuke.com/Community/Forums/tabid/795/forumid/108/postid/361875/scope/posts/Default.aspx