PostgreSQL DATE_TRUNC() function
DATE_TRUNC() function
The date_trunc() function is used to truncate to specified precision.
Syntax:
date_trunc(text, timestamp)
Return Type: timestamp.
PostgreSQL Version: 9.3
Pictorial Presentation of PostgreSQL DATE_TRUNC() function

Example: PostgreSQL DATE_TRUNC() function :
Example:
Code:
SELECT date_trunc('hour', timestamp '2002-09-17 19:27:45');
Sample Output:
date_trunc --------------------- 2002-09-17 19:00:00 (1 row)
Previous: DATE_PART function
Next: EXTRACT function
- New Content published on w3resource:
- HTML-CSS Practical: Exercises, Practice, Solution
- Java Regular Expression: Exercises, Practice, Solution
- Scala Programming Exercises, Practice, Solution
- Python Itertools exercises
- Python Numpy exercises
- Python GeoPy Package exercises
- Python Pandas exercises
- Python nltk exercises
- Python BeautifulSoup exercises
- Form Template
- Composer - PHP Package Manager
- PHPUnit - PHP Testing
- Laravel - PHP Framework
- Angular - JavaScript Framework
- Vue - JavaScript Framework
- Jest - JavaScript Testing Framework