convert string to datetime vb.net

前端 未结 4 1029
北海茫月
北海茫月 2021-01-24 14:15

i need to convert strings to date format. the requirement is if current month is selected, the date should be getdate. if any other month is selected then it should be first of

4条回答
  •  别那么骄傲
    2021-01-24 14:46

    I think the following should do the job for you:

    Dim theDate As DateTime = DateTime.ParseExact(input, "MMMM yyyy", CultureInfo.InvariantCulture)
    

    The InvariantCulture makes sure that the month names can be parsed correctly.

提交回复
热议问题