Digital Workshop

Welcome to the Digital Workshop Message Boards
It is currently October 9th, 2024, 10:16 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 4 posts ] 
Author Message
 Post subject: Calculating with Dates
PostPosted: March 12th, 2006, 9:18 am 
Offline

Joined: November 22nd, 2004, 7:26 pm
Posts: 119
Location: Austria
Hi !

Is there any way that I can subtract two dates in Opus using scripting. For example, I'd like to know how many seconds (or hours, days, etc..) have passed since January 1, 2000. I know that there are comprehensive date functions in Opus , but I'm not good at scripting :D

So, all you wizards out there - this must be a piece of cake for you :D . Can you help me out on this one :?:

Greetings from Austria ,

_________________
Klaus Rosmanitz
Austria


________
XP Home , Opus Pro 5.5


Top
 Profile  
 
 Post subject:
PostPosted: March 12th, 2006, 11:59 am 
Offline

Joined: November 22nd, 2004, 7:26 pm
Posts: 119
Location: Austria
I've managed the scripting using the getTime() function. Now I've got another problem . :D

The result I receive is like this : 6.50318e+009 . How can I turn that into a string so that I can extract substrings, for example, the first three digits, the next three digits etc..

_________________
Klaus Rosmanitz
Austria


________
XP Home , Opus Pro 5.5


Top
 Profile  
 
 Post subject:
PostPosted: March 12th, 2006, 1:11 pm 
Offline

Joined: November 5th, 2004, 1:45 pm
Posts: 92
Location: Lancashire, UK
I use something similar for the courses I produce. I can't recall how I arrived at this code snippet, but the following works well for me and compares today's date and time with a fixed date:

Code:
var CourseEndDate = new Date(2005,6,30,0,0) // months are 0 to 11
var Today = new Date()
var x = CourseEndDate.getTime()
var y = Today.getTime()
var z = (x - y)/86400000
DaysLeft = Math.floor(z)


Andrew


Top
 Profile  
 
 Post subject:
PostPosted: March 12th, 2006, 9:27 pm 
Offline

Joined: November 22nd, 2004, 7:26 pm
Posts: 119
Location: Austria
Thanks Andrew !

I tried out your script. Work's great and is shorter than the code I thought up.

_________________
Klaus Rosmanitz
Austria


________
XP Home , Opus Pro 5.5


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

All times are UTC [ DST ]


Who is online

Users browsing this forum: No registered users and 6 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