List of usage examples for java.time OffsetDateTime parse
public static OffsetDateTime parse(CharSequence text)
From source file:Main.java
public static void main(String[] args) { OffsetDateTime o = OffsetDateTime.parse("2014-09-02T15:22:14.59-07:00"); System.out.println(o);/*from w w w . j a v a 2s.c o m*/ }
From source file:io.smalldata.ohmageomh.data.converter.StringToOffsetDateTimeConverter.java
@Override public OffsetDateTime convert(String source) { if (source == null) { return null; }/*from w w w . ja v a 2s .c o m*/ return OffsetDateTime.parse(source); }
From source file:com.centurylink.cloud.sdk.core.config.OffsetDateTimeDeserializer.java
@Override public OffsetDateTime deserialize(JsonParser arg0, DeserializationContext arg1) throws IOException, JsonProcessingException { return OffsetDateTime.parse(arg0.getText()); }
From source file:keywhiz.api.ApiDate.java
public static ApiDate parse(String s) { OffsetDateTime odt = OffsetDateTime.parse(s); return new ApiDate(odt.toEpochSecond()); }
From source file:net.dv8tion.jda.handle.GuildMemberAddHandler.java
@Override protected String handleInternally(JSONObject content) { if (GuildLock.get(api).isLocked(content.getString("guild_id"))) { return content.getString("guild_id"); }/*from w ww . j a v a 2s . c om*/ GuildImpl guild = (GuildImpl) api.getGuildMap().get(content.getString("guild_id")); User user = new EntityBuilder(api).createUser(content.getJSONObject("user")); if (api.getOffline_pms().containsKey(user.getId())) { PrivateChannel pc = new PrivateChannelImpl(api.getOffline_pms().get(user.getId()), user, api); ((UserImpl) user).setPrivateChannel(pc); api.getOffline_pms().remove(user.getId()); } guild.getUserRoles().put(user, new LinkedList<>()); VoiceStatusImpl voiceStatus = new VoiceStatusImpl(user, guild); guild.getVoiceStatusMap().put(user, voiceStatus); guild.getJoinedAtMap().put(user, OffsetDateTime.parse(content.getString("joined_at"))); api.getEventManager().handle(new GuildMemberJoinEvent(api, responseNumber, guild, user)); EventCache.get(api).playbackCache(EventCache.Type.USER, user.getId()); return null; }
From source file:org.openmhealth.shim.ihealth.mapper.IHealthBloodOxygenEndpointHeartRateDataPointMapperUnitTests.java
@Test public void asDataPointsShouldReturnCorrectSensedDataPoints() { HeartRate expectedHeartRate = new HeartRate.Builder(80) .setEffectiveTimeFrame(OffsetDateTime.parse("2015-09-23T15:46:00-06:00")).build(); assertThat(dataPoints.get(0).getBody(), equalTo(expectedHeartRate)); testDataPointHeader(dataPoints.get(0).getHeader(), SCHEMA_ID, SENSED, "d7fb9db14b0fc3e8e1635720c28bda64", OffsetDateTime.parse("2015-09-23T21:46:00Z")); }
From source file:org.openmhealth.shim.ihealth.mapper.IHealthBloodPressureEndpointHeartRateDataPointMapperUnitTests.java
@Test public void asDataPointsShouldReturnCorrectSensedDataPoints() { HeartRate expectedHeartRate = new HeartRate.Builder(100) .setEffectiveTimeFrame(OffsetDateTime.parse("2015-09-17T12:04:23-08:00")).build(); assertThat(dataPoints.get(0).getBody(), equalTo(expectedHeartRate)); testDataPointHeader(dataPoints.get(0).getHeader(), SCHEMA_ID, SENSED, "c62b84d9d4b7480a8ff2aef1465aa454", OffsetDateTime.parse("2015-09-17T20:04:30Z")); }
From source file:org.openmhealth.shim.fitbit.mapper.FitbitIntradayStepCountDataPointMapperUnitTests.java
@Test public void asDataPointsShouldReturnCorrectDataPoints() { List<DataPoint<StepCount>> dataPoints = mapper.asDataPoints(singletonList(responseNode)); StepCount.Builder stepCountBuilder = new StepCount.Builder(7) .setEffectiveTimeFrame(ofStartDateTimeAndDuration(OffsetDateTime.parse("2015-08-21T00:00:00Z"), new DurationUnitValue(DurationUnit.MINUTE, 1))); assertThat(dataPoints.get(0).getBody(), equalTo(stepCountBuilder.build())); assertThat(dataPoints.get(0).getHeader().getBodySchemaId(), equalTo(StepCount.SCHEMA_ID)); assertThat(dataPoints.get(0).getHeader().getAcquisitionProvenance().getSourceName(), equalTo(RESOURCE_API_SOURCE_NAME)); stepCountBuilder = new StepCount.Builder(52).setEffectiveTimeFrame(ofStartDateTimeAndDuration( OffsetDateTime.parse("2015-08-21T14:28:00Z"), new DurationUnitValue(DurationUnit.MINUTE, 1))); assertThat(dataPoints.get(1).getBody(), equalTo(stepCountBuilder.build())); assertThat(dataPoints.get(1).getHeader().getBodySchemaId(), equalTo(StepCount.SCHEMA_ID)); assertThat(dataPoints.get(1).getHeader().getAcquisitionProvenance().getSourceName(), equalTo(RESOURCE_API_SOURCE_NAME)); }
From source file:org.openmhealth.shim.ihealth.mapper.IHealthBloodPressureDataPointMapperUnitTests.java
@Test public void asDataPointsShouldReturnCorrectSensedDataPoints() { BloodPressure expectedBloodPressure = new BloodPressure.Builder( new SystolicBloodPressure(MM_OF_MERCURY, 120), new DiastolicBloodPressure(MM_OF_MERCURY, 90)) .setEffectiveTimeFrame(OffsetDateTime.parse("2015-09-17T12:04:23-08:00")).build(); assertThat(dataPoints.get(0).getBody(), equalTo(expectedBloodPressure)); DataPointHeader testHeader = dataPoints.get(0).getHeader(); testDataPointHeader(testHeader, SCHEMA_ID, SENSED, "c62b84d9d4b7480a8ff2aef1465aa454", OffsetDateTime.parse("2015-09-17T20:04:30Z")); }
From source file:org.openmhealth.shim.ihealth.mapper.IHealthBodyWeightDataPointMapperUnitTests.java
@Test public void asDataPointsShouldReturnCorrectSensedDataPoints() { BodyWeight expectedBodyWeight = new BodyWeight.Builder( new MassUnitValue(MassUnit.KILOGRAM, 77.5643875134944)) .setEffectiveTimeFrame(OffsetDateTime.parse("2015-09-17T12:04:09-08:00")).build(); assertThat(dataPoints.get(0).getBody(), equalTo(expectedBodyWeight)); DataPointHeader dataPointHeader = dataPoints.get(0).getHeader(); testDataPointHeader(dataPointHeader, SCHEMA_ID, SENSED, "5fe5893c418b48cd8da7954f8b6c2f36", OffsetDateTime.parse("2015-09-17T20:04:17Z")); }