开发者

DateTime from custom datetime string: Mid() has too many parameters?

In the formula below I'm trying to convert a custom date string (yyyymmddhhmmss) into a date (date, not datetime). When I try to save the following I get an error 开发者_JS百科message that states "too many arguments have been given to this function" and both Mid statements are highlighted. The CR IDE shows an overload for Mid that accepts three parameters. I rewrote the formula from scratch a few times to no avail. Any suggestions?

CDate (Left({ABC.ArrivalDT},4),Mid({ABC.ArrivalDT},5,2),Mid({ABC.ArrivalDT},8,2))


DateValue({ABC.ArrivalDT}[1 to 4] + "/" + {ABC.ArrivalDT}[5 to 6] + "/" + {ABC.ArrivalDT}[7 to 8])


okay, here's a solution that works. I also changed my mind and decided to go for a datetime, not just a date as stated in my original post.

CDateTime (
    CDate (
    tonumber(Left({ABC.ArrivalDT},4)),
    tonumber (Mid({ABC.ArrivalDT},5,2)),
    tonumber (Mid({ABC.ArrivalDT},7,2))
    )
,
    CTime (
    tonumber (Mid({ABC.ArrivalDT},9,2)),
    tonumber (Mid({ABC.ArrivalDT},11,2)),
    00
    )
)
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜