HHH-16130 Add javadoc for dateTrunc

This commit is contained in:
Marco Belladelli 2023-02-28 12:30:51 +01:00 committed by Christian Beikov
parent a100dfceda
commit c2ec272ef1
1 changed files with 12 additions and 0 deletions

View File

@ -998,6 +998,18 @@ public interface HibernateCriteriaBuilder extends CriteriaBuilder {
@Incubating
JpaFunction<Float> second(Expression<? extends TemporalAccessor> datetime);
/**
* Truncates a date, time or datetime expression to the given {@link TemporalUnit}.
* Supported units are: {@code YEAR}, {@code MONTH}, {@code DAY}, {@code HOUR}, {@code MINUTE}, {@code SECOND}.
* <p>
* Truncating translates to obtaining a value of the same type in which all temporal units smaller than {@code field} have been pruned.
* For hours, minutes and second this means setting them to {@code 00}. For months and days, this means setting them to {@code 01}.
*
* @param datetime the date, time or datetime expression to be truncated
* @param temporalUnit the temporal unit for truncation
*
* @return the truncated value
*/
@Incubating
<T extends TemporalAccessor> JpaFunction<T> truncate(Expression<T> datetime, TemporalUnit temporalUnit);