Hi everyone,Can you please help me?
I want a C# code for taking time and date from a site and import this time in my program,can you pls help me.

Hi everyone,Can you please help me?
I want a C# code for taking time and date from a site and import this time in my program,can you pls help me.

What site?
Where is the date/time on this site?

As momerath says, this is rather dependent on the page. But if the date and time are in a arbitrary location on the page, you will need to load in the DOM and try and hope that the date/time has an id tag so that you can find it.

Actually I write a Win program in C# ,but I don't want to use local computer current time in my console.I need really current time,It means that for example even when a person changes the computer time or date wrongly,my program showes the time correctly,So I think I should import time and date from a site like yahoo or somthing like that instead of using local computer time and date)
do you have any oponion for helping me?PLS help me

But if I use your program (from the UK) and you're using your local time, then the time will be wrong for me.

I see you're from the states. So you should be aware that different parts of the country are under different timezones, meaning anyone that is not local to your timezone, it will not show the correct time.

There really is no current "true time" unless you count UTC or GMT as timezones are calculated as an offset of these figures.

Your program can only rely on the computer time you are using (to the time your computer is set to).
If you really want to get tan actual curent time (your local or some else time), you will have to connect to an internet and get the time from server.
Check here how this can be done.

Your program can only rely on the computer time you are using (to the time your computer is set to).
If you really want to get tan actual curent time (your local or some else time), you will have to connect to an internet and get the time from server.
Check here how this can be done.

----------------------------------------------------------------------------------------
Hi Mitja Bonca,thank you so much for replying me,You undrestood my request correctly,
but in reality I have been worked on your code,but when I debug it,just a blank console will appear,I'm not professional in C#,can you please help me?
I create new console application,and use your code and also add appropriate references,but the problem is that I don't know what should I insert in my main method:the following Error is appeared:
Error 1 Program 'C:\Documents and Settings\My Documents\Visual Studio 2008\Projects\MFToolkit.Net.Ntp\MFToolkit.Net.Ntp\obj\Debug\MFToolkit.Net.Ntp.exe' does not contain a static 'Main' method suitable for an entry point MFToolkit.Net.Ntp

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.