No, not in that way,
-
<html>
-
<body>
-
<button onclick="var myDate = new Date(); alert(myDate.getTime());">
-
get time
-
</button>
-
</body>
-
</html>
-
i just want to convert the line
"var myDate = new Date(); alert(myDate.getTime());" into C#
If you want the current date and time, use
-
DateTime myDate = DateTime.Now;
-
Now myDate has the current date and time. That object has all the members and methods you need to convert that time to any format or break out any part of it you need.
If this is a Windows Forms application, the next part would be:
-
MessageBox.Show(myDate.ToShortTimeString());
-
If this is an ASP.NET web app, I don't think that there is any way to create a client-side pop up from C#.