Digital Workshop

Welcome to the Digital Workshop Message Boards
It is currently December 23rd, 2024, 7:06 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 5 posts ] 
Author Message
 Post subject: Date function in Opus script for leap year
PostPosted: September 22nd, 2009, 1:33 pm 
Offline

Joined: December 11th, 2004, 12:51 am
Posts: 36
Location: UK
There seems to be a problem with the Date function in Opus script when it reaches a year with 29 days in Feb (a leap year).

It appears that to insist that there are 28 days in Feb 2012 when there should be 29 (or so my outlook calendar says!).

i.e. if you run some script such as:

next_month1 = new Date("Thu Mar 1 2012, 00:00:00");
next_month2 = new Date( 2012, 2, 1);
Debug.trace("next_month1=" + next_month1 + "next_month2=" + next_month2 +"\n")

you get the answer:

Wed Feb 29 2012 00:00:00 in both cases.

note that month=2 is March, as month=0 is Jan, month=1 is Feb, etc.


and...

next_month1 = new Date("Fri Mar 2 2012, 00:00:00");
next_month2 = new Date( 2012, 2, 2);
Debug.trace("next_month1=" + next_month1 + "next_month2=" + next_month2 +"\n")

you get the answer:

Thu Mar 1 2012 00:00:00 in both cases.

i.e. it appears to be always one day behind from then on!

Is there a solution to this anywhere?

/Mark

Opus Pro 06


For this message markatnicebrook has been thanked by : mackavi


Top
 Profile  
 
 Post subject:
PostPosted: September 22nd, 2009, 2:12 pm 
Offline
User avatar

Joined: October 25th, 2004, 10:33 am
Posts: 257
Location: UK
Opus: Pro 8
OS: Windows 7 Professional x64
System: Dell XPS15 i7x4 2.1Ghz 6GB 128GB SSD
Yes that's a bug.

However it's only March in a leap year that'll be wrong. If you put in 1st April into your example, it'll be correct.


For this message Dave Emberton has been thanked by : mackavi


Top
 Profile Visit website  
 
 Post subject: Not to worry!!!
PostPosted: September 24th, 2009, 2:40 pm 
Offline

Joined: October 25th, 2004, 2:20 pm
Posts: 686
Location: Naperville, Illinois (USA)
Opus: 7.05
OS: Win XP SP3
System: P4 3.2GHz 1GB RAM 2-TB HDs + 4 more
Dave –

Not to worry!!! :D According to a documentary I saw this week on the History TV (http://www.history.com) channel, the elaborate calendar systems of the Egyptians, the Mayan civilization, AND the Hopi Indians all end on December 21, 2012 when our Sun is finally located in the exact center of our universe -- called “The Great Alignment”. :oops: They also said Nostradamus agrees. After watching this show, I’m convinced, so I wouldn’t worry about fixing the calendar “bug.” We won’t be around. :P

I’m sure I’m going to get a “pay up sooner” letter from my credit card companies any day now, because they’ll want their money BEFORE the end of time, but that hasn’t stopped me from continuing to charge things. I was even thinking of taking my wife on an elaborate cruise vacation next year (which I’ll charge on my least active credit card) since I won’t be around long enough to pay it off. :roll:

But wait! Didn’t a large group of people say the world was going to end when we went from 1999 to 2000? OK, maybe (to be safe) you should fix the calendar bug – just in case time doesn’t end on December 21, 2012. :wink:

(Can you tell business is slow, and I've got WAY too much time on my hands?) :D

_________________
Fred Harms, Extraordinary Demos
Naperville, Illinois (USA) 630/904-3636
demofred@aol.com


For this message demofred has been thanked by : mackavi


Top
 Profile Visit website  
 
 Post subject:
PostPosted: September 24th, 2009, 3:38 pm 
Offline
Godlike
Godlike
User avatar

Joined: March 21st, 2007, 10:44 am
Posts: 3188
Location: UK
Opus: Evolution
Hi Fred,

Did they give a time? It's just I've got tea with the Queen booked for 11am GMT on that day and I'd hate to miss the appointment - seems rude :-)

As for the bug, my money is on all those unlucky sods born on the 29th February conspiring to make the day last longer.

On a slightly more serious note Mark, if it's necessary to use dates that far in advanced, then I'd create a new function or method and pass the new Date parameters to that instead. A leap year is normally any year dividable by four, the next exception being not for another 91years, so you could use this function to ascertain whether the date is march in a leap year, offset by one day and create the new Date object from this data.

Okay, it's royal pain, but less drastic than the end of world.

Is it Friday yet?

Mack

_________________
When you have explored all avenues of possibilities, what ever remains, how ever improbable, must be the answer.

Interactive Solutions for Business & Education
Learn Anywhere. Learn Anytime.

www.interaktiv.co.uk
+44 (0) 1395 548057


Top
 Profile Visit website  
 
 Post subject:
PostPosted: September 24th, 2009, 10:25 pm 
Offline
Godlike
Godlike

Joined: November 12th, 2005, 1:56 am
Posts: 1474
Location: SFBay Area
Opus: OpusPro v9.0x, & Evol.
OS: Vista32
System: Core 2 duo 2Ghz, RAM 3GB, Nvidia Go 7700 - laptop
When we were younger, we certainly did not look out that far in advance. Probably we only looked ahead a week, and 'get a date' meant something entirely different from the current thread. Now look where we've arrived! (Mac excepted... who has a date with the Queen).

Have you checked if you get same problem using Roman dates? mmxxii/iii/oi ?

_________________
_good things come to those who wait(0)_


For this message Lar_123 has been thanked by : mackavi


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: No registered users and 14 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group