C# datetime.now gives past time

Jey 1 Reputation point

hello there, i have 2 separate projects. when i run the below code from Project1 then it gives me the same time of my laptop time; when i run the same code from another project then it gives 2 hours old time only.

for example, project1 gives time as "13:52" whereas project2 gives time as "11:52". May I know how this different comes and how to resovlve ig?

DateTime now = DateTime.Now().ToString("HH:mm:ss")

thank you

An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
8,180 questions
{count} votes