make_datetime()make_datetime()
根据指定的日期和时间创建一个日期/时间标量值。Creates a datetime scalar value from the specified date and time.
make_datetime(2017,10,01,12,10) == datetime(2017-10-01 12:10)
语法Syntax
make_datetime(
year , month , day)
make_datetime(
year , month , day)
make_datetime(
year , month , day , hour , minute)
make_datetime(
year , month , day , hour , minute)
make_datetime(
year , month , day , hour , minute , second)
make_datetime(
year , month , day , hour , minute , second)
参数Arguments
- year:年(从 0 到 9999 的整数值)year : year (an integer value, from 0 to 9999)
- month:月(从 1 到 12 的整数值)month : month (an integer value, from 1 to 12)
- day:日(从 1 到 28-31 的整数值)day : day (an integer value, from 1 to 28-31)
- hour:小时(从 0 到 23 的整数值)hour : hour (an integer value, from 0 to 23)
- minute:分钟(从 0 到 59 的整数值)minute : minute (an integer value, from 0 to 59)
- second:秒(从 0 到 59.9999999 的实数值)second : second (a real value, from 0 to 59.9999999)
返回Returns
若创建成功,结果将是一个日期/时间值,否则,结果将为 null。If creation is successful, result will be a datetime value, otherwise, result will be null.
示例Example
print year_month_day = make_datetime(2017,10,01)
year_month_dayyear_month_day |
---|
2017-10-01 00:00:00.00000002017-10-01 00:00:00.0000000 |
print year_month_day_hour_minute = make_datetime(2017,10,01,12,10)
year_month_day_hour_minuteyear_month_day_hour_minute |
---|
2017-10-01 12:10:00.00000002017-10-01 12:10:00.0000000 |
print year_month_day_hour_minute_second = make_datetime(2017,10,01,12,11,0.1234567)
year_month_day_hour_minute_secondyear_month_day_hour_minute_second |
---|
2017-10-01 12:11:00.12345672017-10-01 12:11:00.1234567 |