PDA

View Full Version : Just a question



sside
08-16-2004, 10:35 AM
Hello everybody

I was wondering if there is a way in ams5 to calculate what day will be after 100 days. For example;
today is Monday 16-07-2004, Now the question is what will be after 50 or 100 or X days, if there is some way to calculate this.

Thanks a lot

sside
08-16-2004, 12:55 PM
Thank you Buffman for your time
But it's little bit more complicated than that. For example;
In a form the user will be asked to input a date to input1. Let me say the date is 2-feb-2004 (02-02-2004). Now my question is if a have to calculate 100 or 200 days from that date how could it be done. Let me say for the day it can be solved your way but for the date it can't (or not) if i have to calculate that way the day and the date will not match (i think). So how can this problem be solved?
Thanks for your time

rhosk
08-16-2004, 01:40 PM
Try using Julian Date

System.GetDate(3)-2453134

is 100 days ago today.

Just type Julian in the help file search - they have a few examples :)

sside
08-16-2004, 07:26 PM
Hello everybody

I tried it but no luck. Also in the help menu was nothing that would fit in my project.
I want to count from a date in the past forward. For example if the given date is 02-02-2004, 100 days later would be smth like this 12-08-2004 (for example). Now if i try with julian calendar there are two problems;
1-There is no way that i know what date it was in the past (02-02-2004). Even if i knew it, it would be smth like this 2345678 and 100 days further (for example) would be 2345678 + 100 = 2345778.
2-I need to convert this outcome (2345778 for example) into a understandable date (12-08-2004 for example) and to let the user know what it would be after 100 days. And i cannot convert this number into a understandable date.
Please correct me if i'm wrong. Is got to be some other way but ...
Anyway i thank you for your time and advises.

Worm
08-16-2004, 08:03 PM
This is something I threw together a little while ago. I think it'll take care of your needs.



Hello everybody

I was wondering if there is a way in ams5 to calculate what day will be after 100 days. For example;
today is Monday 16-07-2004, Now the question is what will be after 50 or 100 or X days, if there is some way to calculate this.

Thanks a lot

TJ_Tigger
08-16-2004, 08:19 PM
Worm is just too cool. :yes :D

Intrigued
08-16-2004, 08:26 PM
This is something I threw together a little while ago. I think it'll take care of your needs.
Thanks go to Worm for helping me recently by creating that little application he just posted (which contains a .dll he created)! It works great Worm, thanks!

I was thinking it was best to see a post from Worm himself.

Note: Worm, you must of been the guy that excelled in the high jump; because you sure are good at setting and then raising the bar for us here in the forums! (grin)

Sincerely,

sside
08-17-2004, 07:56 AM
Perfect. This is exactly what i was looking for. You can take a look at it. In my project only the inserted date is unknown (it's up to the user) but the days to be added is a fixed number. The only thing what i miss is the european date format :D.

Anyway i thank you for your help

I just agree with TJ_Tigger (Worm is just too cool) and Intrigued (Worm, you must of been the guy that excelled in the high jump; because you sure are good at setting and then raising the bar for us here in the forums!)

Greetings everybody

Worm
08-17-2004, 08:44 AM
You need to add this line of code in the OnKey event before you make the call to the DLL:


sBaseDate = String.Replace(sBaseDate, "/", "-", false)

The DLL only accepts the hyphen (-) as the delimiter in the date. Using the / will not work.

Also, you should easily be able to have the date entered in any format you want. Simply swap the year, month, and day around before you make the call. As I said, the DLL looks for and returns and ISO fomatted date.