C# এ একটি ফাইল তৈরির সময় পেতে, CreationTime() পদ্ধতি ব্যবহার করুন।
এর জন্য, ফাইল ইনফো এবং ডেটটাইম ক্লাসগুলি ব্যবহার করুন৷ প্রতিটির একটি অবজেক্ট তৈরি করুন -
FileInfo file = new FileInfo("new.txt");
DateTime dt = file.CreationTime; আসুন সম্পূর্ণ কোডটি দেখি -
উদাহরণ
using System.IO;
using System;
public class Program {
public static void Main() {
using (StreamWriter sw = new StreamWriter("qa.txt")) {
sw.WriteLine("Questions and Answers!");
}
FileInfo file = new FileInfo("qa.txt");
// file creation time
DateTime dt = file.CreationTime;
Console.WriteLine(dt);
}
} আউটপুট
9/5/2018 5:20:03 AM