當前位置: 首頁>>代碼示例>>Java>>正文


Java DateTimeZone.setDefault方法代碼示例

本文整理匯總了Java中org.joda.time.DateTimeZone.setDefault方法的典型用法代碼示例。如果您正苦於以下問題:Java DateTimeZone.setDefault方法的具體用法?Java DateTimeZone.setDefault怎麽用?Java DateTimeZone.setDefault使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.joda.time.DateTimeZone的用法示例。


在下文中一共展示了DateTimeZone.setDefault方法的11個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: onSetUpInTransaction

import org.joda.time.DateTimeZone; //導入方法依賴的package包/類
@Override
protected void onSetUpInTransaction() throws Exception
{
    nodeService = (NodeService)applicationContext.getBean(ServiceRegistry.NODE_SERVICE.getLocalName());
    importerService = (ImporterService)applicationContext.getBean(ServiceRegistry.IMPORTER_SERVICE.getLocalName());
    
    importerBootstrap = (ImporterBootstrap)applicationContext.getBean("spacesBootstrap");
    
    this.authenticationComponent = (AuthenticationComponent)this.applicationContext.getBean("authenticationComponent");
    
    this.authenticationComponent.setSystemUserAsCurrentUser();
    
    this.versionService = (VersionService)this.applicationContext.getBean("VersionService");
    
    // Create the store
    this.storeRef = nodeService.createStore(StoreRef.PROTOCOL_WORKSPACE, "Test_" + System.currentTimeMillis());
    
    TimeZone tz = TimeZone.getTimeZone("GMT");
    TimeZone.setDefault(tz);
    // Joda time has already grabbed the JVM zone so re-set it here
    DateTimeZone.setDefault(DateTimeZone.forTimeZone(tz));
}
 
開發者ID:Alfresco,項目名稱:alfresco-repository,代碼行數:23,代碼來源:ImporterComponentTest.java

示例2: setUp

import org.joda.time.DateTimeZone; //導入方法依賴的package包/類
/**
 * Ensures that the temp locations are cleaned out before the tests start
 */
@Override
public void setUp() throws Exception
{
    // Grab the context, which will normally have been
    //  cached by the ApplicationContextHelper
    ctx = MiscContextTestSuite.getMinimalContext();
    
    this.mimetypeMap = (MimetypeMap) ctx.getBean("mimetypeService");
    this.dictionaryService = (DictionaryService) ctx.getBean("dictionaryService");
    
    // perform a little cleaning up
    long now = System.currentTimeMillis();
    TempFileProvider.TempFileCleanerJob.removeFiles(now);
    
    TimeZone tz = TimeZone.getTimeZone("GMT");
    TimeZone.setDefault(tz);
    // Joda time has already grabbed the JVM zone so re-set it here
    DateTimeZone.setDefault(DateTimeZone.forTimeZone(tz));
}
 
開發者ID:Alfresco,項目名稱:alfresco-repository,代碼行數:23,代碼來源:AbstractMetadataExtracterTest.java

示例3: init

import org.joda.time.DateTimeZone; //導入方法依賴的package包/類
@PostConstruct
public void init() {

    // Just to be extra sure
    TimeZone.setDefault(TimeZone.getTimeZone("UTC"));
    DateTimeZone.setDefault(DateTimeZone.UTC);

    log.info("System going for boot. Server status: {}", this.serverStatus);

    // setServerStatus(ServerStatus.BOOTING);
    // statusChangeEvents.fire(ServerStatus.BOOTING);

    // use default granularity
    triggerDataLoad(0);
}
 
開發者ID:RWTH-i5-IDSG,項目名稱:xsharing-services-router,代碼行數:16,代碼來源:CoreBootstrapper.java

示例4: testCastTimestampToDate

import org.joda.time.DateTimeZone; //導入方法依賴的package包/類
@Test
public void testCastTimestampToDate() throws Exception {
  String[] tzs = {"America/Los_Angeles", "UTC", "Europe/Paris", "Pacific/Auckland", "Australia/Melbourne"};
  for (String tz : tzs) {
    DateTimeZone.setDefault(DateTimeZone.forID(tz));
    testBuilder()
      .sqlQuery("SELECT CAST(`datetime0` AS DATE) res1 FROM (VALUES({ts '2016-01-02 00:46:36'})) tbl(datetime0)")
      .ordered()
      .baselineColumns("res1")
      .baselineValues(new LocalDateTime(2016, 1, 2, 0, 0))
      .go();
  }
}
 
開發者ID:dremio,項目名稱:dremio-oss,代碼行數:14,代碼來源:TestNewDateFunctions.java

示例5: stringToTimestampChangeTZ

import org.joda.time.DateTimeZone; //導入方法依賴的package包/類
@Test
public void stringToTimestampChangeTZ() {
  DateTimeZone defaultTZ = DateTimeZone.getDefault();
  try {
    DateTimeZone.setDefault(DateTimeZone.forID("America/Los_Angeles"));
    assertEquals(1236478747000L, formatTimeStamp("2009-03-08 02:19:07", getFormatterForFormatString("YYYY-MM-DD HH:MI:SS")));
  } finally {
    DateTimeZone.setDefault(defaultTZ);
  }
}
 
開發者ID:dremio,項目名稱:dremio-oss,代碼行數:11,代碼來源:TestDateFunctionsUtils.java

示例6: stringToTimestampChangeTZOffset

import org.joda.time.DateTimeZone; //導入方法依賴的package包/類
@Test
public void stringToTimestampChangeTZOffset() {
  DateTimeZone defaultTZ = DateTimeZone.getDefault();
  try {
    assertEquals(calculateTime("2008-09-15 10:53:00"), formatTimeStamp("2008-09-15T15:53:00+0500", getFormatterForFormatString("YYYY-MM-DD\"T\"HH24:MI:SSTZO")));
    assertEquals(calculateTime("2011-01-01 04:00:00"), formatTimeStamp("2010-12-31T23:00:00-0500", getFormatterForFormatString("YYYY-MM-DD\"T\"HH24:MI:SSTZO")));
    assertEquals(calculateTime("2010-12-31 23:00:00"), formatTimeStamp("2010-12-31T23:00:00", getFormatterForFormatString("YYYY-MM-DD\"T\"HH24:MI:SS")));
  } finally {
    DateTimeZone.setDefault(defaultTZ);
  }
}
 
開發者ID:dremio,項目名稱:dremio-oss,代碼行數:12,代碼來源:TestDateFunctionsUtils.java

示例7: before

import org.joda.time.DateTimeZone; //導入方法依賴的package包/類
@Override
protected void before() throws Throwable {
    super.before();
    DateTimeZone.setDefault(DateTimeZone.UTC);
}
 
開發者ID:3wks,項目名稱:generator-thundr-gae-react,代碼行數:6,代碼來源:TimeZoneUTC.java

示例8: after

import org.joda.time.DateTimeZone; //導入方法依賴的package包/類
@Override
protected void after() {
    super.after();
    DateTimeZone.setDefault(origDefault);
}
 
開發者ID:3wks,項目名稱:generator-thundr-gae-react,代碼行數:6,代碼來源:TimeZoneUTC.java

示例9: setDefaults

import org.joda.time.DateTimeZone; //導入方法依賴的package包/類
protected void setDefaults()
{
    DateTimeZone.setDefault(DateTimeZone.UTC); //Joda
    Locale.setDefault(Locale.UK);
    TimeZone.setDefault(TimeZone.getTimeZone("UTC"));
}
 
開發者ID:Alfresco,項目名稱:alfresco-data-model,代碼行數:7,代碼來源:SearchDateConversionTest.java

示例10: SystemInitializer

import org.joda.time.DateTimeZone; //導入方法依賴的package包/類
@Inject
SystemInitializer(ActorSystem system,
                  ApplicationLifecycle lifecycle,
                  EmailComposer composer,
                  @Named("exam-auto-saver-actor") ActorRef examAutoSaver,
                  @Named("reservation-checker-actor") ActorRef reservationChecker,
                  @Named("auto-evaluation-notifier-actor") ActorRef autoEvaluationNotifier,
                  @Named("exam-expiration-actor") ActorRef examExpirationChecker,
                  @Named("assessment-sender-actor") ActorRef assessmentSender,
                  @Named("reservation-reminder-actor") ActorRef reservationReminder) {

    this.system = system;
    this.composer = composer;

    String encoding = System.getProperty("file.encoding");
    if (!encoding.equals("UTF-8")) {
        Logger.warn("Default encoding is other than UTF-8 ({}). " +
                "This might cause problems with non-ASCII character handling!", encoding);
    }

    System.setProperty("user.timezone", "UTC");
    TimeZone.setDefault(TimeZone.getTimeZone("UTC"));
    DateTimeZone.setDefault(DateTimeZone.forID("UTC"));

    tasks.put("AUTO_SAVER", system.scheduler().schedule(
            Duration.create(EXAM_AUTO_SAVER_START_AFTER_SECONDS, TimeUnit.SECONDS),
            Duration.create(EXAM_AUTO_SAVER_INTERVAL_MINUTES, TimeUnit.MINUTES),
            examAutoSaver, "tick",
            system.dispatcher(), null
    ));
    tasks.put("RESERVATION_POLLER", system.scheduler().schedule(
            Duration.create(RESERVATION_POLLER_START_AFTER_SECONDS, TimeUnit.SECONDS),
            Duration.create(RESERVATION_POLLER_INTERVAL_HOURS, TimeUnit.HOURS),
            reservationChecker, "tick",
            system.dispatcher(), null
    ));
    tasks.put("EXPIRY_POLLER", system.scheduler().schedule(
            Duration.create(EXAM_EXPIRY_POLLER_START_AFTER_SECONDS, TimeUnit.SECONDS),
            Duration.create(EXAM_EXPIRY_POLLER_INTERVAL_DAYS, TimeUnit.DAYS),
            examExpirationChecker, "tick",
            system.dispatcher(), null
    ));
    tasks.put("AUTOEVALUATION_NOTIFIER", system.scheduler().schedule(
            Duration.create(AUTO_EVALUATION_NOTIFIER_START_AFTER_SECONDS, TimeUnit.SECONDS),
            Duration.create(AUTO_EVALUATION_NOTIFIER_INTERVAL_MINUTES, TimeUnit.MINUTES),
            autoEvaluationNotifier, "tick",
            system.dispatcher(), null
    ));
    tasks.put("EXTERNAL_EXAM_SENDER", system.scheduler().schedule(
            Duration.create(ASSESSMENT_SENDER_START_AFTER_SECONDS, TimeUnit.SECONDS),
            Duration.create(ASSESSMENT_SENDER_INTERVAL_HOURS, TimeUnit.HOURS),
            assessmentSender, "tick", system.dispatcher(), null
    ));
    tasks.put("RESERVATION_REMINDER", system.scheduler().schedule(
            Duration.create(RESERVATION_REMINDER_START_AFTER_SECONDS, TimeUnit.SECONDS),
            Duration.create(RESERVATION_REMINDER_INTERVAL_MINUTES, TimeUnit.MINUTES),
            reservationReminder, "tick", system.dispatcher(), null
    ));

    scheduleWeeklyReport();

    lifecycle.addStopHook(() -> {
        cancelTasks();
        system.terminate();
        return CompletableFuture.completedFuture(null);
    });
}
 
開發者ID:CSCfi,項目名稱:exam,代碼行數:68,代碼來源:SystemInitializer.java

示例11: before

import org.joda.time.DateTimeZone; //導入方法依賴的package包/類
@Before
public void before() {
  DateTimeZone.setDefault(DateTimeZone.forID("America/Los_Angeles"));
}
 
開發者ID:dremio,項目名稱:dremio-oss,代碼行數:5,代碼來源:TestNewDateFunctions.java


注:本文中的org.joda.time.DateTimeZone.setDefault方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。