当前位置: 首页>>代码示例>>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;未经允许,请勿转载。