Sign in to follow this  
Followers 0
nadeem0035

Get Date and time From Server instead machine Time

6 posts in this topic

#include<Date.au3>
MsgBox(64, "DD/MM/YYYY", _NowDate())

Dear this is code to get date from local machine...

I want to get this date from server machine because some time our machine date may be wrong or changed ..

I want exact date through server using internet.

Please help and tell code for this??????????

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

I think you should look at solving the problem rather than monitoring it. The way I would approach this problem is to periodically check the current time from a server on the internet. Some code like this:

#include <INet.au3>
$source = _INetGetSource("http://tycho.usno.navy.mil/cgi-bin/timer.pl")
MsgBox(0, "", $source)

Then write some code to extract the time zone closest to you. Add or subtract the hours needed to adjust for your time zone. Then you could use _Date_Time_SetSystemTime to set the time. You could use Window's Task Scheduler to run the script every day or every few hours.

Edited by sleepydvdr

#include <ByteMe.au3>

Share this post


Link to post
Share on other sites

Good job..........

But i want to use this for monitoring purpose to secure our program

or

tell me other way to secure my program for trial period.

Share this post


Link to post
Share on other sites

I am sorry. I completely misunderstood what you were asking. This is what you need:


#include <ByteMe.au3>

Share this post


Link to post
Share on other sites

I am sorry. I completely misunderstood what you were asking. This is what you need:

Yessssssssssss

Like some thing

but i want used simple to get date from server and match the script date and decide run or not using if condition ...

Is it possible if then how ????????????????????????????

Thankssssss

Share this post


Link to post
Share on other sites

I think that in order to do that, you would have to set up an NTP time server and somehow make it broadcast publicly.

Or you may be able to set up a website that always displays the current date/time and use similar code from my first post to check it. Kind of like the Naval website did it.

Think about this: what if they are using a laptop and cannot connect to the internet? What if your server is down? Does that mean that everyone who has your software will not be able to use it?


#include <ByteMe.au3>

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0