Validate the datetime value: Difference between revisions

Jump to navigation Jump to search
no edit summary
mNo edit summary
No edit summary
Line 41: Line 41:
== PHP appracoh ==
== PHP appracoh ==
Using PHP [https://www.php.net/manual/en/function.strtotime.php strtotime] function
Using PHP [https://www.php.net/manual/en/function.strtotime.php strtotime] function
== Excel approach ==
# Validate the total length of cell value is equal to 10 e.g. {{kbd | key=<nowiki>=IF(LEN(B2)<>10, TRUE, FALSE)</nowiki>}}
# Validate the positions of the {{kbd | key=<nowiki>-</nowiki>}} symbols
# Combined the above condition, the verify formula is: (If the cell value is well-formatted, the formula returns true)
<pre>
=NOT(
    IF(OR(
          ISERROR(FIND("-", B2, 1)),
          ISERROR(FIND("-", B2, 6)),
          IF(LEN(B2)<>10, TRUE, FALSE)
          ), TRUE, FALSE)
)
</pre>


== References ==
== References ==
Anonymous user

Navigation menu