# Date time feature derive and date time intervals

Date time variable usually handles as follow:

Functions are provided in SPL that automatically handle date-time variables

A.datederive(T) and P.datederive(cn, T) can generate multiple derivative variables for a datetime sequence variable, and the derivative variables automatically perform subsequent pre-processing.

Specifically, the function will split the variable into two parts: date and time, and then derive fields such as month, season and holiday from the date variable, and derive fields such as morning and afternoon from the time variable, and automatically delete the unary variable, high miss rate variable and other useless variables, and perform possible smoothing operations.

A.dateinterval(T) and P.dateinterval(cns, T) generate multiple date difference variables for a sequence of datetime variables. And the derivative variables automatically perform subsequent pre-processing

For example:

 A 1 =100.(date(2020,rand(11)+1,rand(28)+1)) 2 =100.(date(2021,rand(11)+1,rand(28)+1)) 3 =100.(rand(500)) 4 =A1.datederive@i(A3) 5 =A2.datederive@r(A4(2)) 6 =[A1,A2].dateinterval@i(A3)

A1, A2 Randomly generate 100 date-time data, representing modeling data and prediction data respectively

A3 Randomly generate 100 integers less than 500 as target variable

A4 Derive for A1, return the derived result and the derived record Rec. @i indicates that the target variable are integers.

A5 The same derivation is performed on the prediction data based on the Rec. @r means that the same preprocessing operation is performed on the prediction data.

A6 Calculate the date interval of A1 and A2, and automatically perform subsequent preprocessing actions