cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Date Calendar and Time functions.mcd

Highlighted
Opal

Date Calendar and Time functions.mcd

Here is a selection of functions for dates, calendars, and times. Also included is a calendar component that allows a date to be selected by the user. The scripted components were all written by me, but the additional functions at the end of the worksheet were not. In fact, I don't know who did write some of them, but if the author of those functions, or someone who knows who the author is, reads this then please let me know who did write them so I can credit them correctly.

Jun 09 2015: Added a worksheet for Mathcad Prime. This includes only the limited set of functions not based on scripted components.

20 REPLIES 20
Highlighted

Re: Date Calendar and Time functions.mcd

does it contain some excel objects. As i'm seeing weird images in the file.

Using Mathcad 14.0.0.163

Highlighted

Re: Date Calendar and Time functions.mcd

No. It contains two functions written as scripted components though. Those functions are based on ClipArt objects (for no particularly good reason - just a whim), so perhaps that is what you are seeing.

Highlighted

Re: Date Calendar and Time functions.mcd

it would be nice if i can extract the individual parts from CurrentDateAndTime function.

for eg.

CurrentDateAndTime("Year") should give me just the year part in integer not string so i can perform calculations on them.

Also in your question how many days have passed since start of year. it should automatically pick the start of the year. rather than having me enter it manually. So is the date is in 2003 it should automatically pick 1/1/2003.

Highlighted

Re: Date Calendar and Time functions.mcd

it would be nice if i can extract the individual parts from CurrentDateAndTime function.

for eg.

CurrentDateAndTime("Year") should give me just the year part in integer not string so i can perform calculations on them.

I added two more functions

Also in your question how many days have passed since start of year. it should automatically pick the start of the year. rather than having me enter it manually. So is the date is in 2003 it should automatically pick 1/1/2003.

That's also taken care of by the new functions.

Highlighted

Re: Date Calendar and Time functions.mcd

thanks richard this is great addition

i think if just a time is given it should be assumed to be current date rather than dec 1899

Highlighted

Re: Date Calendar and Time functions.mcd

Oh the second term in split function is quarter. hmmm

Highlighted

Re: Date Calendar and Time functions.mcd

The attached image just sank my computer when trying to open.

If saved on my hardrive the image cannot be seen.

Mike

Highlighted

Re: Date Calendar and Time functions.mcd

it was my mistake. there is nothing wrong with the function. I didn't realize that the second term is a quarter not month.

btw how did you manage to show your SplitDate function as (2010 1 2 4 X X X X)

mine is showing as a table. is that an alternative way to show a vector.

Highlighted

Re: Date Calendar and Time functions.mcd

Double left click on the result of the function, select "Display Option" tab and change the matrix display style to a Matrix.

Mike

Highlighted

Re: Date Calendar and Time functions.mcd

The attached image just sank my computer when trying to open.

If saved on my hardrive the image cannot be seen.

What image are you talking about?

Highlighted

Re: Date Calendar and Time functions.mcd

I'm not going mad.........Am I?????

Think Ziyad removed it

Mike

Highlighted

Re: Date Calendar and Time functions.mcd

i think if just a time is given it should be assumed to be current date rather than dec 1899

I don't much care for that behavior either, but I'm just hijacking a VBscipt function, and that's the way it works. The only way I could fix it would be to do a fair amount of string handling or regular expression matching to trap the case when there is only a time. Too much work. Sorry.

Highlighted

Re: Date Calendar and Time functions.mcd

thats fine Richard. I don't want to impose a hard solution for a small problem.

you have already helped me alot with date stuff.

Thank you

Highlighted

Re: Date Calendar and Time functions.mcd

Did you get time to change SplitDate function to be able to use a vector of dates

Highlighted

Re: Date Calendar and Time functions.mcd

Did you get time to change SplitDate function to be able to use a vector of dates

Sorrry, not yet. It turned into a very busy weekend. I will try and get to it tomorrow.

Highlighted

Re: Date Calendar and Time functions.mcd

OK, I have uploaded a new version of the document. SplitDate and AssembleDate now handle multiple dates at one time.

For completeness, I also added the functions form here:

http://communities.ptc.com/docs/DOC-1431

to the end of the document.

Highlighted

Re: Date Calendar and Time functions.mcd

Very helpful.  Thanks

Highlighted

Re: Date Calendar and Time functions.mcd

Neat.  Good work.

Highlighted

Re: Date Calendar and Time functions.mcd

Neat.  Good work.

Thanks. I just felt my head swell slightly

Highlighted

Re: Date Calendar and Time functions.mcd

Richard,

Your worksheet on dates does show where some of the functions came from.  One Terry Hendicott who does not claim creation but lists the book that they came from.  They are a translation from C++ functions in the reference.

Glad to see contributions are reused - refined and upgraded.

Cheers.

Announcements