Skip to main content
12-Amethyst
February 25, 2021
Solved

Current Date

  • February 25, 2021
  • 1 reply
  • 5068 views

Hi all 

 

what is best way to get mathcad to reference todays date?

 

I want to add a function that removes functionality of the sheet after day 6 months should another user try to access it. So will write a statement like the following 

 

If todays date is > 01/01/2022 then etc...

 

 

Best answer by Werner_E

Here is an example of my last suggestion

Werner_E_1-1614255968809.png

 

 

1 reply

25-Diamond I
February 25, 2021

Are you talking about real Mathcad or just Prime?
In Mathcad you could use a scripted component to get and return the current date.

In Prime you can use the time() function which gives you the number of seconds since 1.1.1970. You can now write a routine to get the current date using the number returned by time(0).

You can find solutions for both approaches by searching in this forum.

Another way is using an Excel component with the current date in a cell. Kind of using a sledgehammer to crack a nut 😉

For your purpose you won't need the current date, though. Simply add the number of seconds in six months to the result given by time(0) now. If the result of time(0) exceeds this number, its six months later. You may be generous and use 31 days for a month 😉

 

12-Amethyst
February 25, 2021

Hi its in Mathcad Prime 6.0.0.0

 

 

25-Diamond I
February 25, 2021

So you can't use the first suggestion (scripted component).

But the other three still apply