Java Code Examples for com.google.cloud.Date#fromYearMonthDay()

The following examples show how to use com.google.cloud.Date#fromYearMonthDay() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: RandomValueGenerator.java    From DataflowTemplates with Apache License 2.0 4 votes vote down vote up
private Date randomDate() {
  int year = 1980 + random.nextInt(40);
  int month = 1 + random.nextInt(11);
  int day = 1 + random.nextInt(27);
  return Date.fromYearMonthDay(year, month, day);
}
 
Example 2
Source File: SpannerConvertersTest.java    From spring-cloud-gcp with Apache License 2.0 4 votes vote down vote up
@Test
public void sqlDateConversionTest() {
	Date date = Date.fromYearMonthDay(2018, 3, 29);
	assertThat(SpannerConverters.JAVA_SQL_TO_SPANNER_DATE_CONVERTER
			.convert(SpannerConverters.SPANNER_TO_JAVA_SQL_DATE_CONVERTER.convert(date))).isEqualTo(date);
}