IonicWind Software

Announcements => User Offerings => Topic started by: Andy on August 21, 2013, 01:21:16 AM

Title: Working with dates
Post by: Andy on August 21, 2013, 01:21:16 AM
Hi,

Just thought I would post this example on how to munipulate dates.

I cannot take any credit for this just thought I would pull it all together in one easy example.

Andy.
:)
Title: Re: Working with dates
Post by: AdrianFox on August 21, 2013, 05:44:22 AM
Thanks for posting this.  It is very 'elegant' and could be very useful. 

:)
Title: Re: Working with dates
Post by: Andy on August 21, 2013, 06:16:15 AM
Thanks Adrian,

So many people have helped me in the past including yourself, I just like to try and help anyone I can.

Andy.
:)
Title: Re: Working with dates
Post by: Bill-Bo on August 23, 2013, 07:10:48 PM
andy,

Great program, but it is off one day. I checked with today's date, and
my wife's and my birthdates. All one day later.

If you make Sunday the first in your "DayNames=" instead of last,
everything works fine.

BTW. I enter the day and month with 2 digits each, and 4 digits for the
year.

Please add an option to do another date so you wont have to start
if for each one.

Thanks

Bill
Title: Re: Working with dates
Post by: Andy on August 24, 2013, 12:34:39 AM
Thanks Bill,

I have amended the program so you can see what happends to both dates, i.e. the one you enter and the
next day.

Also, if you press 'Y' at the end you can enter another date.  :)

Regarding the day being out by one, this is strange as it works for my birthday and all the other dates I have tested it with, it has never been out on my PC.

Before posting this I tested, tested and re-tested - wonder why you are showing out by one day

Strange  ???

Andy.
Title: Re: Working with dates
Post by: Bill-Bo on August 24, 2013, 07:20:45 AM
andy,

I do not need the next day stuff. What I was trying to get
across was that when I first ran your program it giving the
day of the week a day later that it was suppose to be.

I was born on a Friday. Your program said I it was Saturday.
My wife, Monday. Your program said Tuesday.

13 Dec 1946 was a Friday
23 Jul 1951 was a Monday

Whatever you did to the program, it is now giving the correct
day. But next day stuff is not need. I don't know how that
came about.

Bill
Title: Re: Working with dates
Post by: Andy on August 25, 2013, 09:08:32 AM
Hi Bill,

Are you sure you read the origional screen correctly?

It took a date you entered and then found the next day. it then told you what the next day (day of week) would be. Not the date you entered.

Maybe that's the confusion (and maybe I didn't make it clear enough).

Anyway, glad it's working for you now.

Andy.
:)


Title: Re: Working with dates
Post by: Brian on August 26, 2013, 07:16:40 AM
Funny, it crashes eventually for me. It shows "The next day is" for a few seconds,
and then asks to send a love letter to Microsoft. Dunno what that is...

Brian
Title: Re: Working with dates
Post by: Andy on August 26, 2013, 11:11:10 PM
Hi Brian,

Cannot understand why it crashes eventually, i'm using Win 7 32 bit on my pc.

I use the method that I posted in a couple of programs and they have never crashed on me.

One program is constantly working with dates as it is a staff rota solution for my friend.

When you say it "eventually" crashes - how many times do you use it before it happends? and what O/S are you using?

Re: sending a love letter to Microsoft - i presume you mean a crash report.

Please let me know and I'll try to figure it out.
Andy.


Title: Re: Working with dates
Post by: Brian on August 27, 2013, 11:46:49 AM
Hi, Andy,

I thought it was my fault, as I had it compiling as a Window, but it still crashes as a Console
It manages to print this line: PRINT " The next day is ", dj$, ".",mj$,".",yj$
hangs a couple of seconds, then brings up the MS error window. I keep looking, but I cannot see anything
Using Windows XP SP3

Brian
Title: Re: Working with dates
Post by: Andy on August 27, 2013, 10:51:57 PM
Hi Brian,

Well I spotted something, I wasn't passing a value to the year field needed to get the start of the year.

Attached is the corrected verrsion.

That said, I connected my old disk with XP service pack 3 (Home edition) and ran both versions - but still could not get it to crash?

Anyway, could you try the new attached version and let me know please.

Andy.
:)
Title: Re: Working with dates
Post by: Brian on August 28, 2013, 11:58:10 AM
Andy,

Still doesn't work. If you enter 28 08 2013 (which is today, of course), it returns Monday,
instead of Wednesday

And it still crashes. Appended a version which has all the variables defined

Brian