Code examples for Date

Codota analyzed 7,668,838 open source code samples to find the most common, credible and clear examples.
You can now enable Codota on your own code to easily search and navigate your Java codebase.
39:	this.now = new Date(); 
Full Snippet Info
9
CodeRank
24:	json.put("date", date.getDate()); 
25:	json.put("day", date.getDay()); 
26:	json.put("hours", date.getHours()); 
27:	json.put("minutes", date.getMinutes()); 
28:	json.put("month", date.getMonth()); 
29:	json.put("seconds", date.getSeconds()); 
30:	json.put("time", date.getTime()); 
31:	json.put("timezoneOffset", date.getTimezoneOffset()); 
32:	json.put("year", date.getYear()); 
Full Snippet Info
9
CodeRank
36:	final Date date = new Date(); 
37:	BasicDBObject doc = new BasicDBObject( "foo" , date); 
38:	assertTrue( doc.getDate( "foo" ).equals( date ) ); 
Full Snippet Info
8
CodeRank
268:	date.setTime(date.getTime() / 1000L * 1000); 
269:	date.setHours(0); 
270:	date.setMinutes(0); 
271:	date.setSeconds(0); 
272:	return date.getTime(); 
Full Snippet Info
8
CodeRank
33:	Date date = new Date(); 
34:	date.setYear(110); 
35:	date.setMonth(04); 
36:	date.setDate(20); 
37:	date.setHours(10); 
38:	date.setMinutes(25); 
39:	date.setSeconds(30); 
-
43:	String parsedDateString = Util.formatDateToString(date); 
Full Snippet Info
8
CodeRank
24:	this.reference = past.value().equals("") ? new Date() : AlternativeDateFormat.getDefaultFormatter().parse(past.value()); 
Full Snippet Info
9
CodeRank
25:	this.reference = future.value().equals("") ? new Date() : AlternativeDateFormat.getDefaultFormatter().parse(future.value()); 
Full Snippet Info
9
CodeRank
53:	Date date = new Date(time); 
54:	date.setHours(0); 
55:	date.setMinutes(0); 
56:	date.setSeconds(0); 
57:	date.setTime(date.getTime() - date.getTimezoneOffset() * 60000); 
58:	DateTime dateTime = new DateTime(date, TimeZone.getTimeZone("UTC")); 
Full Snippet Info
8
CodeRank
42:	Date date = new Date(); 
43:	date.setMonth(date.getMonth() + 1); 
44:	return date.getTime(); 
Full Snippet Info
8
CodeRank
104:	} else if (date.getMinutes() == 0 && excludeZeroMinutes){ 
-
110:	return new SimpleDateFormat(value).format(date); 
-
130:	String month = DateUtils.getMonthString(date.getMonth() + 
-
144:	standardDate = new SimpleDateFormat(value).format(date).replace("#", month).replace("$", "\u65E5"); //$NON-NLS-1$ 
-
146:	standardDate = new SimpleDateFormat(value).format(date).replace("#", month).replace("$", "\uC77C"); //$NON-NLS-1$ 
-
148:	standardDate = new SimpleDateFormat(value).format(date).replace("#", month).replace("$", ""); 
Full Snippet Info
7
CodeRank
196:	Date date = new Date(); 
197:	Object actual = this.conversionService.convert(date, TypeDescriptor.valueOf(Date.class), TypeDescriptor.valueOf(String.class)); 
198:	String expected = date.toString(); 
Full Snippet Info
7
CodeRank
58:	if (date.getHours() == 23 && date.getMinutes() == 59 && date.getSeconds() == 59) { 
59:	date.setHours(12); 
60:	date.setMinutes(0); 
61:	date.setSeconds(0); 
Full Snippet Info
8
CodeRank
105:	Date oneSecondAgo = new Date(System.currentTimeMillis() - 1000); 
-
112:	props.put("SomeDates.last_index_time", oneSecondAgo); 
113:	props.put("last_index_time", oneSecondAgo); 
-
127:	Assert.assertTrue("This date: " + errMsgFormat.format(oneSecondAgo) + " should be prior to the document date: " + errMsgFormat.format(docDate), docDate.getTime() - oneSecondAgo.getTime() > 0); 
128:	Assert.assertTrue("This date: " + errMsgFormat.format(oneSecondAgo) + " should be prior to the entity date: " + errMsgFormat.format(entityDate), entityDate.getTime() - oneSecondAgo.getTime() > 0); 
Full Snippet Info
7
CodeRank
80:	date = new Date(); 
Full Snippet Info
9
CodeRank
110:	this.converter.write(new Date(), null, this.response); 
Full Snippet Info
7
CodeRank
55:	Date currentTime = new Date(); 
56:	accountService.setClock(new MockClock(currentTime)); 
-
62:	assertThat(user.getRegisterDate()).isEqualTo(currentTime); 
Full Snippet Info
7
CodeRank
53:	setStartTime(new Date()); 
Full Snippet Info
8
CodeRank
40:	Date now = new Date(); 
Full Snippet Info
8
CodeRank
39:	return new SimpleDateFormat(value).format(date); 
Full Snippet Info
7
CodeRank
55:	Date now = new Date(); 
-
58:	webDavProps.setCreateDate(now); 
59:	webDavProps.setModifiedDate(now); 
Full Snippet Info
7
CodeRank