Commonly Used in DB2 development ----- date function (commonly used date function) get time 1. Get current date: values current date; 2012-08-28 2. Get current time of values; 11:56:36 3. Obtain the current timestamp; 2012-08-28 11:57:32 4. year () obtain the current year values year (current timestamp); 2012 5. month () get the value of the current month (current timestamp); 8 6, day () Get the value of the current day (current timestamp); 28 7, hour () values hour (current timestamp); 12 8, minute () Get current minute values minute (current timestamp); 3 9, second () get second values second (current timestamp); 48 10, microsecond () Get millisecond values microsecond (current timestamp); 59000 11, timestamp convert to varchar values varchar_format (current timestamp, 'yyyy-mm-dd hh24-mm-ss '); extract date values date (current timestamp) from 2012-08-28 12-08-21 12, timestamp ); extract time values time (current timestamp) from and timestamp; 12:14:51. The Dayname () related to the week returns the day of the week in the date parameter. Return Value Type: String. For example: monday values dayname (current timestamp); Tuesday Dayofweek () returns the day of the week in the date parameter; Return Value Type: integer; example: 1; 1 indicates Sunday values dayofweek (current timestamp ); 3 ---- today is the day of the week in the Tuesday Dayofweek_iso () returned date parameter, Return Value Type: integer; for example: 1; 1 represents Monday values dayofweek_iso (current timestamp ); 2 ---- today is the Week of the year in which the Tuesday Week () is returned, and the return value is an integer in the range of (1-54, take Sunday as the week's start values Week (timestamp ('2017-1-8 '); 2 week () returns the Week of the year in which the date parameter is located, returns an integer in the range of (1-53). Monday is used as the start values week_iso (timestamp ('2017-1-8 ') of a week ')); 1 15. Varchar_format (<time>, 'yyyy-mm-dd') between time and String Conversion return value: string values varchar_format (current timestamp, 'yyyy-mm-dd hh24-mm-ss '); 2012-08-28 12-08-37 To_char () values to_char (current timestamp); Aug 28,201 2 12:37:33 PM Char () values char (current timestamp); 2012-08-28-12.38.10.387000 values char (time ('22: 24: 23'); 22.24.23 string to Date or time Date () values date ('2017-1-1 '); 2012-01-01 Time () values time ('22. 22.22 '); 22:22:22 Timestamp () values timestamp ('2017-1-1-22.42.23.000890'); 2012 22:42:23 16. Calculate the value current date + 1 year + 2 months + 4 days; 17. Time Difference Calculation Timestampdiff () Prerequisites: 1. Skip the year; 2. Assume that only 30 days a month, 1 = seconds of decimal part, 2 = seconds 4 = Minute 8 = hour 16 = days 32 = weeks 64 = months 128 = quarter 256 = year timestampdiff (2, char (current timestamp-timestamp (task. create _) exact calculation () Return Value: INTEGER (DAYS (<timestamp1>)-DAYS (<timestamp2>) * 86400 + (MIDNIGHT_SECONDS (<timestamp1>) -MIDNIGHT_SECONDS (<timestamp2> ))'