~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to docs/functions/date_trunc.rst

  • Committer: Mark Atwood
  • Date: 2011-08-11 03:05:03 UTC
  • mfrom: (2385.1.12 refactor4)
  • Revision ID: me@mark.atwood.name-20110811030503-rp9xjihc5x3y0x4q
mergeĀ lp:~olafvdspek/drizzle/refactor4

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
date_trunc
2
 
==========
 
 
b'\\ No newline at end of file'
 
1
DATE TRUNC
 
2
===========
 
3
 
 
4
DATE_TRUNC truncates a date to a specified precision. The idea is similar to the trunc function for numbers.
 
5
 
 
6
The syntax is: date_trunc(text, source)
 
7
 
 
8
Valid values for *text* are:
 
9
 
 
10
* microseconds
 
11
* milliseconds
 
12
* second
 
13
* minute
 
14
* hour
 
15
* day
 
16
* week
 
17
* month
 
18
* quarter
 
19
* year
 
20
* decade
 
21
* century
 
22
* millennium
 
23
 
 
24
In this example, 'source' is a TIMESTAMP value with microsecond precision:
 
25
 
 
26
.. code-block:: mysql
 
27
 
 
28
        date_trunc('hour', timestamp '2011-02-26 10:35:44:712005')
 
29
 
 
30
Returns: 2011-02-26 10:00:00