【特性】cfg datetime的在excel格式下支持excel内置的时间格式

main
walon 2021-08-04 16:50:59 +08:00
parent fb733f751a
commit 8d95e8539a
4 changed files with 17 additions and 6 deletions

View File

@ -392,11 +392,15 @@ text的key和text字段都是string类型因此在连续单元格或者sep产
## datetime 类型 ## datetime 类型
- 时间是常用的数据类型。Luban 特地提供了支持。 - 时间是常用的数据类型。Luban 特地提供了支持。
填写格式为 以下 4 种。 有两种形式,一种以纯字符串的方式填写。
- yyyy-mm-dd hh:mm:ss 如 1999-08-08 01:30:29 - 以纯字符串方式填写
- yyyy-mm-dd hh:mm 如 2000-08-07 07:40 填写格式为 以下 4 种。
- yyyy-mm-dd hh 如 2001-09-05 07 - yyyy-mm-dd hh:mm:ss 如 1999-08-08 01:30:29
- yyyy-mm-dd 如 2003-04-05 - yyyy-mm-dd hh:mm 如 2000-08-07 07:40
- yyyy-mm-dd hh 如 2001-09-05 07
- yyyy-mm-dd 如 2003-04-05
- 以 excel内置的时间格式填写
- 为 Item 新增一个 失效时间字段 expire_time 。 - 为 Item 新增一个 失效时间字段 expire_time 。
- [定义](images/adv/def_38.png) - [定义](images/adv/def_38.png)
``` xml ``` xml
@ -405,7 +409,10 @@ text的key和text字段都是string类型因此在连续单元格或者sep产
<var name="expire_time" type="datetime"/> <var name="expire_time" type="datetime"/>
</bean> </bean>
``` ```
- 配置 - 配置
图中红框中第一个时间以 excel的时间格式填写
剩下第234个时间以 纯字符串形式填写
![如图](images/adv/def_39.png) ![如图](images/adv/def_39.png)
## convert 常量替换 ## convert 常量替换

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

After

Width:  |  Height:  |  Size: 17 KiB

View File

@ -483,6 +483,10 @@ namespace Luban.Job.Cfg.DataCreators
{ {
return null; return null;
} }
if (d is System.DateTime datetime)
{
return new DDateTime(datetime);
}
return DataUtil.CreateDateTime(d.ToString()); return DataUtil.CreateDateTime(d.ToString());
} }
} }