compare dates in String format

后端 未结 10 1322
时光说笑
时光说笑 2021-02-12 16:30

I\'m getting two dates as String values and I wanted to check start time is earlier than the end time. I compare them as it is without converting them to date using Simple

10条回答
  •  别那么骄傲
    2021-02-12 17:20

    I would recommend converting them to date first to be a little safer, but as long as you are SURE the format (or timezone, etc...) will never change on you, then a date compare and comparing that format of string should always be equivalent.

提交回复
热议问题