How to convert time string


#1

My script is reading a cell where value mentioned as 7:00:00 PM, Format of cell is time in IST format.

I want to convert this value to text so that it look like as 19:00 which is CST format. how I can do this.


#2

Hi @Saurabh_Sahu,

You could try to follow the example below:

DateTime localTime = DateTime.Now;

// 24 hour format -- use 'H' or 'HH'
string timeString24Hour = localTime.ToString("HH:mm", CultureInfo.CurrentCulture);