Hi icod,
你是想要按子字符串“ - ”对“2020-12-26 - 2021-01-01”进行分割,从而获得两个单独的日期吗?
你可以尝试调用Split(String[],
StringSplitOptions)。请参考以下示例。
string date = "2020-12-26 - 2021-01-01";
string[] dates = date.Split(new string[] { " - " }, StringSplitOptions.None);
string date1 = dates[0];
string date2 = dates[1];
Regards,
Kyle
MSDN Community Support
Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to
MSDN Support, feel free to contact MSDNFSF@microsoft.com.