Click here to Skip to main content
16,018,394 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
i want to use time stamp in windows service by c#
to told me the servuce running.
when stop return time stamp that mean the service was stopped???
Posted
Updated 9-Mar-13 5:31am
v2
Comments
[no name] 9-Mar-13 12:03pm    
Okay.... very unclear. If you want to use a timestamp in a service what is stopping you from doing so?
omar maher 9-Mar-13 12:16pm    
how can i use it??
by the code
iam beginner
can u give me example to create time stamp
[no name] 9-Mar-13 12:35pm    
First of all "beginner" is completely meaningless. I know people that have been coming to this site for years and they still post that they are "beginners" in order to invoke sympathy from others because they are just too lazy to do some basic research.

Being a beginner does not mean that you are incapable of asking a clear question. What is it that you think a "timestamp" is? Your definition and my definition might be vastly different. Did you look up DateTime in the documentation? Maybe the DateTime.Now method would be of some interest to you.

As to how you use it... that is completely up to you. I would have no idea what it is that you think you want to do with it.
omar maher 9-Mar-13 14:42pm    
i want to use time stamp to detramine to me service is running becase when pc shut down or fail
i want the stamp stop to return value

1 solution

What do you mean by timestamp? You want to track the activity of a service, to see when it was started or stopped? In this case you should use the Windows Event log, and write appropriate event handlers. The event log is by default there, and most of the services do log their status changes in it.
See following article: http://www.a2zmenu.com/Tutorials/CSharp/Creating-a-Windows-Service-in-CSharp.aspx[^]
 
Share this answer
 
Comments
omar maher 9-Mar-13 14:43pm    
i want to use time stamp to detramine to me service is running becase when pc shut down or fail i want the stamp stop to return value
becouse when time stamp stop to return value i waill switch to anther server to start service in it
Zoltán Zörgő 9-Mar-13 15:41pm    
Sorry, but your "sentences" make no sense in English.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900