Checking today's date on boot up - Forum

Forum Navigation
You need to log in to create posts and topics.

Checking today's date on boot up

I stumbled on a very interesting (probably older) Scripted Logic web page:

http://www.scriptedlogic.com/zzold/neoHOW7.htm

It is checking a date entered in [TextEntry1].

However, is it possible to compare the current date with an expiration date set by the user on app boot up? So that the app auto-closes when it is launched after that specific date?

This could be used to create rudimentary demo protection of a Neo app (assuming the user does not want to go through the hassle of changing the system clock).

I am picturing the following Pseudo Action Code in Page Properties:

If "[TodaysDate]" ">=" ""
AlertBox "Expired!" "Your grace period has expired."
Delay "4000"
Exit "" ""
Else
GotoPage "Main"
EndIf

If anyone has a sample app for this with working code that would be appreciated!

Another option would be for the app to store today's date in a variable and then (silently) set a (calendar) date to self-destruct after 30 days?

@talker:

The site you referred to belongs to me.

is it possible to compare the current date with an expiration date set by the user

You do not need that code to compare two dates ... the easiest way is to perform a DateToNum on both dates (https://winhelp.visualneo.com/Control.html#DATETONUM )

DateToNum "date" "format" "variable"

... then compare the two resulting numbers ... take appropriate action depending on the result being negative/positive.

The referenced Help page includes an example that calculates the number of days since December 15th, 2004 ... you should be able to modify the code to meet your requirements ... let us know if you run into problems.

Thank you Gaev. Appreciate your reply.

I slightly modified this section from the Help file:

DateToNum "6/12/2022" "m/d/y" "[StartDate]"
DateToNum "[DateShort]" "Default" "[Today]"
Math "[Today]-[StartDate]" "0" "[Result]"
AlertBox "Answer" "It has been [Result] days since 6/12/2022"

In that case, it says:
It has been two days since 6/12/2022

But it's not clear to me how to compare/specify whether the difference between [StartDate] and [Today] is less then, let's say 30 days...

@talker

But it's not clear to me how to compare/specify whether the difference between [StartDate] and [Today] is less then, let's say 30 days...

How about ...

DateToNum "6/12/2022" "m/d/y" "[StartDate]"
DateToNum "[DateShort]" "Default" "[Today]"
Math "[Today]-[StartDate]" "0" "[Result]"
...AlertBox "Answer" "It has been [Result] days since 6/12/2022"

If "[Result]" ">=" "30"
   AlertBox "Expired!" "Your grace period has expired."
   Delay "4000"
   Exit "" ""
Else
   GotoPage "Main"
EndIf

 

Vadim and javadrajabihakami have reacted to this post.
Vadimjavadrajabihakami

Thank you!

That works a treat :-).

Hi @talker,

This topic is considerated on another post.

 

keep in mind that it is very easy to alter the system date, so it is possible to pervert actions related to the integrity of dates and programs.

I am seeing that the most convenient is the execution of the web:

https://tf.nist.gov/tf-cgi/servers.cgi

which would be the most reliable way to verify the integrity of the real date and time and that of the system

 

Added the function at NeoDates Plugin:

ae_Dates_GetNISTDate

Purpose: Get the System Date/Time based on the

NIST Internet Time Service

Returns a lot of info about Date / Location / Julian Date / Delays and another info.

You could check about at:

https://www.nist.gov/pml/time-and-frequency-division/time-distribution/internet-time-service-its

Now you can be sure of the date and time on your computer forever.

NeoDates is in this link:

https://aplicaciones.xp3.biz/neobook/misc.html

Thanks David. That sounds really usable.

Do you have any downloadable demo versions of your plug-ins?

I don't see a link anywhere...

@talker,

 

Send me an email at

aplicaciones (at) rocketmail (dot) com

and i will send you the generic sample plugin

Greetings from Buenos Aires

David de Argentina

 

David,

I send you an email yesterday. Did you receive it?

@talker,

Sent yesterday.

Check you spam folder

No, it's not there. Can you resend it?

I just resent this.

Try to download at:

https://aplicaciones.xp3.biz/neobook/NeoDates_Generic.zip

Greetings from Buenos Aires,

David de Argentina

@talker,

Reread the zip I sent you in the previous post.

It appears as a false positive.

After I remove the check mark from compress using UPX, everything seems to work fine.

Thanks. Downloaded it.

I'll check it out.