跳到主要内容

通过公式将文本转换为日期格式

1. 使用场景

借助此例我们学习一下如何通过宜搭公式将文本转换为日期格式。

2. 实现功能

2.1 配置表单页面

2.2 配置字段公式

注意根据实际需求修改字段。

(1)日期时间(年月日)

{"text":"TIMESTAMP(DATE(MID(​文本时间​,1,4),MID(​文本时间​,5,2),MID(​文本时间​,7,2)))","marks":[{"from":{"line":0,"ch":19,"sticky":null},"to":{"line":0,"ch":25,"sticky":null},"value":"textField_ksh9bz3r","invalid":false},{"from":{"line":0,"ch":35,"sticky":null},"to":{"line":0,"ch":41,"sticky":null},"value":"textField_ksh9bz3r","invalid":false},{"from":{"line":0,"ch":51,"sticky":null},"to":{"line":0,"ch":57,"sticky":null},"value":"textField_ksh9bz3r","invalid":false}],"isCmData":true}

(2)日期时间(年月日时分秒)

{"text":"TIMESTAMP(DATE(MID(​文本时间​,1,4),MID(​文本时间​,5,2),MID(​文本时间​,7,2),MID(​文本时间​,9,2),MID(​文本时间​,11,2),MID(​文本时间​,13,2)))","marks":[{"from":{"line":0,"ch":19,"sticky":null},"to":{"line":0,"ch":25,"sticky":null},"value":"textField_ksh9bz3r","invalid":false},{"from":{"line":0,"ch":35,"sticky":null},"to":{"line":0,"ch":41,"sticky":null},"value":"textField_ksh9bz3r","invalid":false},{"from":{"line":0,"ch":51,"sticky":null},"to":{"line":0,"ch":57,"sticky":null},"value":"textField_ksh9bz3r","invalid":false},{"from":{"line":0,"ch":67,"sticky":null},"to":{"line":0,"ch":73,"sticky":null},"value":"textField_ksh9bz3r","invalid":false},{"from":{"line":0,"ch":83,"sticky":null},"to":{"line":0,"ch":89,"sticky":null},"value":"textField_ksh9bz3r","invalid":false},{"from":{"line":0,"ch":100,"sticky":null},"to":{"line":0,"ch":106,"sticky":null},"value":"textField_ksh9bz3r","invalid":false}],"isCmData":true}

3. 实现效果

4. 在线试玩

Copyright © 2024钉钉(中国)信息技术有限公司和/或其关联公司浙ICP备18037475号-4