Search
 
SCRIPT & CODE EXAMPLE
 

CSHARP

c sharp convert string time into 24 hours time

DateTime dateTime = DateTime.Now;
string strMinFormat = dateTime.ToString("hh:mm:ss tt");//12 hours format
string strMaxFormat = dateTime.ToString("HH:mm:ss tt");//24 hours format
Comment

c sharp convert string time into 24 hours time

using System;

class Solution
{
    static string timeConversion(string s)
    {
        return DateTime.Parse(s).ToString("HH:mm");
    }

    static void Main(string[] args)
    {
        Console.WriteLine(timeConversion("01:00 PM"));
        Console.Read();
    }
}
Comment

c sharp convert string time into 24 hours time

using System;
namespace Demo {
   public class Program {
      public static void Main(string[] args) {
         DateTime d = DateTime.Parse("05:00 PM");
         Console.WriteLine(d.ToString("HH:mm"));
      }
   }
}
Comment

PREVIOUS NEXT
Code Example
Csharp :: docker Test a Connection using Curl 
Csharp :: telerik mvc grid column with icon 
Csharp :: how to find the text position in excel in c# 
Csharp :: xamarin set environment variables 
Csharp :: how to subtract two dates in dart 
Csharp :: how to generate random unique id in c# 
Csharp :: list array 
Csharp :: unity reload active scene 
Csharp :: get all properties of an object including children c# 
Csharp :: dynamic add event control c# 
Csharp :: Merge two List using Linq 
Csharp :: c# integer part of float 
Csharp :: change skybox color unity 
Csharp :: c# loop through queue 
Csharp :: unity stop velocity movement 
Csharp :: #grid 
Csharp :: c# mock ref parameter 
Csharp :: c# unit test exception using try catch 
Csharp :: BulkWrite c# example mongodb 
Csharp :: the name scripts does not exist in the current context mvc 5 
Csharp :: web.config customerrors not working 
Csharp :: subtract to time c# 
Csharp :: system.random reuses numbers 
Csharp :: Get replace normal text from word document in C# 
Csharp :: c# convert bitmap to image 
Csharp :: Check if list contains any of another list 
Csharp :: *ngif vs ngif 
Csharp :: js if empty then 0 
Csharp :: add rotation 
Csharp :: dataannotations for currency in c# 
ADD CONTENT
Topic
Content
Source link
Name
9+1 =