~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to docs/functions/date_trunc.rst

  • Committer: Marisa Plumb
  • Date: 2011-03-11 15:54:41 UTC
  • mto: (2235.2.4 build)
  • mto: This revision was merged to the branch mainline in revision 2237.
  • Revision ID: marisa.plumb@gmail.com-20110311155441-1qamt9gp8v9nxiht
current time function fixes

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
DATE TRUNC
2
 
===========
 
 
b'\\ No newline at end of file'
 
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