Hi Kendall,
If there is a way to use the default timezone that would be better.
If you specify no timezone, the default timezone is used indeed. If I run the following query… jobs:eval('1', map {}, map { 'start': '12:00:00' }) …the jobs:list-details() function will show you the start time of your query as UTC: <job id="job983" type="ScheduledXQuery" state="scheduled" user="admin" start="2017-07-30T10:00:00.001Z" reads="(none)" writes="(none)">1</job> Nonetheless, you can also specify a timezone in the time string. All values are allowed that are legal arguments for xs:dateTime(). The next query will run the embedded query five seconds after query execution: let $date := current-dateTime() + xs:dayTimeDuration('PT5S') return ( $date, jobs:eval('1', map {}, map { 'start': string($date) }) ) On my system, it output something like: 2017-07-29T23:46:56.327+02:00 job991 Hope this helps, Christian
Meanwhile,
I made a module so that I can use source from JDK 1.8.x:
package somewhere;
import java.time.LocalDateTime;
import java.time.ZonedDateTime;
import java.time.ZoneId;
import java.time.format.DateTimeFormatter;
import org.basex.query.QueryException;
import org.basex.query.QueryModule;
public class Time extends QueryModule {
public String zonedTime(String pattern) throws QueryException {
return ZonedDateTime.from(LocalDateTime.now()
.withHour(20)
.withMinute(0)
.withSecond(0)
.atZone(ZoneId.systemDefault()))
.withZoneSameInstant(ZoneId.of("UTC"))
.format(DateTimeFormatter.ofPattern(pattern));
}
}
and, then in XQuery:
jobs:eval(‘trace(“WENT”)’, map {}, map {‘id’: ‘somejob’, ‘start’: t:zoned-time(‘HH:mm:ss’)})
Kendall
From: <basex-talk-bounces@mailman.uni-konstanz.de> on behalf of Kendall Shaw <kendall.shaw@workday.com> Date: Friday, July 28, 2017 at 2:37 PM To: BaseX <basex-talk@mailman.uni-konstanz.de> Subject: [basex-talk] Timezone and job start time
declare namespace tz = "java:java.time.ZonedDateTime";
tz:now()
returns 2017-07-28T14:23:08.334-07:00[America/Los_Angeles]
Logs in dba seem to use the local time zone to display the date.
The timestamp on resources is in UTC time, which is good.
modified-date=”2017-07-28T21:17:53.347Z”
But, do I have to use UTC time for scheduling jobs?
For example:
job:eval(‘…’, map {}, map {‘start’: ‘20:00:00’})
schedules the job for 5AM instead of 10PM, I think.
If I can assume the time is UTC then I can figure out how to schedule the correct time. But, can I assume that it is UTC, or can I specify a Zoned time without a date?
Kendall