How to change the string date into specific date format.
I want to change the string date e.g. from 26 Feb 2020 to 2020-02-24 (yyyy-MM-dd).
Can anyone please suggest the solution for this.
How to change the string date into specific date format.
I want to change the string date e.g. from 26 Feb 2020 to 2020-02-24 (yyyy-MM-dd).
Can anyone please suggest the solution for this.
Hi @vaibhav2.chavan try this
date_1=“26 Feb 2020”
date_2= DateTime.ParseExact(date_1, “dd MMM yyyy”,System.Globalization.CultureInfo.InvariantCulture).ToString(“yyyy-MM-dd”)
Try this way
Regards
Nived N
Happy Automation
@NIVED_NAMBIAR - Thanks for reply, but i’m getting the below error, can you please have a look on it.
Hi @vaibhav2.chavan it should be Culturalnfo instead of CulturalInfo
I had corrected in my first response.
Please check
Culturelnfo instead of CulturalInfo
sometimes it hangs in the cache:
or just do the same within a second assign and if its working delete first assign.
also take a note on:
import namespace:
and change the part to: System.Globalization. CultureInfo.InvariantCulture
Please check this one for correction of error
Please correct the typo:
As mentioned above. After adding System.Globalization to the namespace imports you can go with the shortened name: CultureInfo.InvariantCulture
WINDOWS系统可以设置日期时间的表示格式,从/形式改为-形式
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.