Hi to all,
I collected with a scraping, this date, as a String.
I should convert it to Datetime to upload it to the Database.
In the table, seconds are missing, so I would like to set all seconds = 00
ex: 2022-05-15 9:47:00
Can help me with this?
Thanks
Aaron
Srini84
(Srinivas Kadamati)
May 17, 2022, 3:18pm
2
@AaronMark
Check below for your reference
@Sami_Syed
String to DateTime:
Date.ParseExact(yourStringVar, “d/MM/yyyy”,CultureInfo.InvariantCulture)
ensure System.Globalization namespace is imported
Increment Date
(e.g. Add 1 day, other AddXX Functions are available as well
yourDateTimeVariable.AddDays(1)
DateTime to String:
yourDateTimeVariable.ToString(“d/MM/yyyy”)
Hope this may help you
Thanks
Hello,
You can try this:
DateTime.ParseExact(“12/05/2019 9.20”,“dd/MM/yyyy h.mm”,System.Globalization.CultureInfo.InvariantCulture).ToString(“dd-MM-yyyy hh:mm:ss”)
Thanks!
Athira
Thanks Athira.
I had to tweak the string a little, but the hint was very helpful.
DateTime.ParseExact(Data_Firma_PDA,“dd/MM/yyyy H.mm”,System.Globalization.CultureInfo.InvariantCulture).ToString(“yyyy-MM-dd HH:mm:ss”)
1 Like
system
(system)
Closed
May 20, 2022, 3:57pm
5
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.