And:

t:time(20, ‘HH:mm:ss’)

which is 8pm not 10pm…

From: <basex-talk-boun...@mailman.uni-konstanz.de> on behalf of Kendall Shaw 
<kendall.s...@workday.com>
Date: Saturday, July 29, 2017 at 1:27 PM
To: BaseX <basex-talk@mailman.uni-konstanz.de>
Subject: Re: [basex-talk] Timezone and job start time

Oops, I mean:

package workday;

import java.math.BigInteger;
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(BigInteger hour, String pattern) throws 
QueryException {
    return  ZonedDateTime.from(LocalDateTime.now()
                                            .withHour(hour.intValue())
                                            .withMinute(0)
                                            .withSecond(0)
                                            .atZone(ZoneId.systemDefault()))
                         .withZoneSameInstant(ZoneId.of("UTC"))
                         .format(DateTimeFormatter.ofPattern(pattern));
  }
}


From: <basex-talk-boun...@mailman.uni-konstanz.de> on behalf of Kendall Shaw 
<kendall.s...@workday.com>
Date: Saturday, July 29, 2017 at 1:17 PM
To: BaseX <basex-talk@mailman.uni-konstanz.de>
Subject: Re: [basex-talk] Timezone and job start time

I think I can assume it is UTC.

org/basex/util/DateTime.java contains:

  static { FULL.setTimeZone(TimeZone.getTimeZone("UTC")); }

If there is a way to use the default timezone that would be better. 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-boun...@mailman.uni-konstanz.de> on behalf of Kendall Shaw 
<kendall.s...@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


Reply via email to