কম্পিউটার টিউটোরিয়াল

C#-এ DateTime.ToLongTimeString() মেথড

C#-এ DateTime.ToLongTimeString() মেথডটি বর্তমান DateTime অবজেক্টের মানকে তার সমতুল্য লম্বা সময় স্ট্রিং উপস্থাপনায় রূপান্তর করতে ব্যবহৃত হয়।

সিনট্যাক্স

public string ToLongTimeString ();

উদাহরণ: বর্তমান সময়ের সাথে

using System; 
using System.Globalization; 
public class Demo { 
    public static void Main() { 
        DateTime d = DateTime.Now; 
        Console.WriteLine("Date = {0}", d); 
        Console.WriteLine("Current culture = " + CultureInfo.CurrentCulture.Name); 
        var pattern = CultureInfo.CurrentCulture.DateTimeFormat; 
        string str = d.ToLongTimeString(); 
        Console.WriteLine("Long time string = {0}", pattern.LongTimePattern); 
        Console.WriteLine("Long time string representation = {0}", str); 
    } 
}

আউটপুট

Date = 10/16/2019 8:41:03 AM Current culture = en-US Long time string = h:mm:ss tt Long time string representation = 8:41:03 AM

উদাহরণ: নির্দিষ্ট তারিখের সাথে

using System; 
public class Demo { 
    public static void Main() { 
        DateTime d = new DateTime(2019, 11, 11, 7, 11, 25); 
        Console.WriteLine("Date = {0}", d); 
        string str = d.ToLongTimeString(); 
        Console.WriteLine("Long time string representation = {0}", str); 
    } 
}

আউটপুট

Date = 11/11/2019 7:11:25 AM Long time string representation = 7:11:25 AM
  1. C#-এ DateTime.AddMilliseconds() মেথড

  2. C#-এ DateTime.GetHashCode() মেথড

  3. C#-এ DateTime.GetDateTimeFormats() মেথড

  4. C#-এ DateTime.FromOADate() মেথড