How to change the date separator from mm/dd/yyyy to mm.dd.yyyy and add 00:00 in the end?

This is my input 01/08/2015 and i want it to look like this 01.08.2015 00:00

Can someone help me I currently have a code I have assigned it to hostDateFrom = DateTime.ParseExact(hostDateFrom.toString(), “MM/dd/yyyy”, Globalization.CultureInfo.InvariantCulture).ToString(“MM.dd.yyyy”)
but im getting an error


Can you try String.Replace mathod as the following?


yourString.Replace("/",".")+" 00:00"


HI @Greggy

Checkout this expression

DateTime.ParseExact(hostDateFrom.toString, “MM/dd/yyyy”, System.Globalization.CultureInfo.InvariantCulture).ToString(“MM.dd.yyyy hh:mm”)


Hi @Greggy try this:

DateTime.ParseExact(yourdatevariable, “MM/dd/yyyy”, Globalization.CultureInfo.InvariantCulture).ToString(“MM.dd.yyyy hh:mm”)

Hi @Greggy

Try like this expression

DateTime.ParseExact(hostDateFrom.toString, “MM/dd/yyyy”, System.Globalization.CultureInfo.InvariantCulture).ToString(“MM.dd.yyyy HH:mm”)


CDate(hostDateFrom.toString).Tostring("MM.dd.yyyy HH:mm")



Check out this blog and tutorial for more reference


Hello @Greggy
try this

DateTime.ParseExact(hostDateFrom.toString.Trim, “MM/dd/yyyy”, System.Globalization.CultureInfo.InvariantCulture).ToString(“MM.dd.yyyy HH:mm”)

@Greggy , Kindly share the what type of error you are facing.

If you have error like value is not a valid date format something like this

  • Keep a message box and print the hostDateFrom and check the format there if the format in the expression and the message box differ add the additional format in the expression like
DateTime.ParseExact(hostDateFrom.toString,{"MM/dd/yyyy","MM/dd/yyyy hh:mm:ss","dd.MM.yyyy"}, System.Globalization.CultureInfo.InvariantCulture,System.Globalization.DateTimeStyles.None).ToString(“MM.dd.yyyy hh:mm”)

You can simply add the any number of date formats inside the {“”,“”} and the formats should be seperated by comma

The above expression will look into array of string and choose the apt format as per the input string and convert them and return you the output of desired format


Hi @Greggy

You can use DateTime.ParseExact(hostDateFrom.toString(), “MM/dd/yyyy”, Globalization.CultureInfo.InvariantCulture).ToString(“MM.dd.yyyy 00:00”) adding 00:00 will add a static time as you need and also I see you have the value back to hostDateFrom. If hostDateFrom is in Date format than it will fail as the output of right argument is string and you are trying to assign to Date

If you need date than add like this DateTime.ParseExact(DateTime.ParseExact(hostDateFrom.toString(), “MM/dd/yyyy”, Globalization.CultureInfo.InvariantCulture).ToString(“MM.dd.yyyy 00:00”)“MM.dd.yyyy hh:mm”, Globalization.CultureInfo.InvariantCulture)


DateTime.ParseExact(hostDateFrom.toString, “MM/dd/yyyy”, System.Globalization.CultureInfo.InvariantCulture).ToString(“MM.dd.yyyy hh:mm”)

or modify Date activity