How to get DateTime when starting the current process?

How to get DateTime when the current process started?

+3
source share
4 answers

The property StartTimein the type Processreturns this value:

Process.GetCurrentProcess().StartTime

This, of course, can be used to pick up the start time of other processes:

Process p = Process.GetProcessesByName("Notepad").FirstOrDefault();
if (p != null)
{
    Console.WriteLine(p.StartTime);
}
+15
source

I think you need Process.StartTime .

+2
source

, System.Diagnostics.

using System.Diagnostics;

.

public DateTime GetStartTime()
{
    return Process.GetCurrentProcess().StartTime;
}
+2

,

static DateTime startTime = DateTime.Now;

- ,

0

Source: https://habr.com/ru/post/1727638/


All Articles