On development life we are daily use date function may be its for filter,Or its calculate reports .
Lets Create some of examples with using of date functions over Force.com(SOQL)
There are different date functions are available in SOQL.
- HOUR_IN_DAY()
- DAY_IN_WEEK()
- DAY_IN_YEAR()
HOUR_IN_DAY():its help you to returns a number representing the hour in the day for a dateTime field.
Example:- SELECT HOUR_IN_DAY(convertTimezone(CreatedDate)) FROM ACCOUNT GROUP BY HOUR_IN_DAY(convertTimezone(CreatedDate))
OUTPUT:-22,2,3,6
DAY_IN_WEEK(): its help you to returns a number representing the day of the week for a date field.
Example:- SELECT DAY_IN_WEEK(CreatedDate) FROM ACCOUNT GROUP BY DAY_IN_WEEK(CreatedDate)
- SUN DAY
- MON DAY
- TUE DAY
- WED DAY
- THU DAY
- FRI DAY
- SAT DAY
DAY_IN_YEAR(): its help you to Returns a number representing the day in the year for a date field
EXAMPLE: SELECT DAY_IN_YEAR(CreatedDate) FROM ACCOUNT GROUP BY DAY_IN_YEAR(CreatedDate)
2015-01-13T06:50:46.000+0000-13
2015-01-04T18:26:57.000+0000-4
2015-03-02T10:54:45.000+0000-61
I will share you all other stubs that related to Date functions.