添加链接
link管理
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接
相关文章推荐
刀枪不入的核桃  ·  Event update (i.e. ...·  1 周前    · 
体贴的蘑菇  ·  Dynamic MANIFEST.MF ...·  1 周前    · 
打盹的斑马  ·  JavaScript Date Formats·  1 周前    · 
有腹肌的豆腐  ·  Preserving time-date ...·  1 周前    · 
急躁的吐司  ·  RTSP 支持·  3 月前    · 
孤独的鞭炮  ·  Is there more ...·  5 月前    · 
有腹肌的猕猴桃  ·  Communications Mining ...·  6 月前    · 
爱旅游的啤酒  ·  Arrays·  8 月前    · 
耍酷的鸡蛋面  ·  使用 AWS CDK in ...·  9 月前    · 

PostgreSQL DATE_PART() function

DATE_PART() function

The date_part() function is used to return the part of a date and time.

Syntax:

date_part(text, timestamp) date_part(text, interval)

Return Type: double precision.

PostgreSQL Version: 9.3

Pictorial Presentation of PostgreSQL DATE_PART() function

Example 1: PostgreSQL DATE_PART() function

The example below finds the hour part from the timestamp (date and time specified in the argument) .

code:

SELECT date_part('hour', timestamp '2002-09-17 19:27:45');

Sample Output:

date_part ----------- (1 row)

Example 2: PostgreSQL DATE_PART() function

The example below extracts the months part the given age.

Code:

SELECT date_part('month', interval '3 years 7 months');

Sample Output:

date_part ----------- (1 row)

Previous: CURRENT_TIMESTAMP function
Next: DATE_TRUNC function

Follow us on Facebook and Twitter for latest update.