Digital Workshop

Welcome to the Digital Workshop Message Boards
It is currently January 11th, 2025, 12:02 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 9 posts ] 
Author Message
 Post subject: Correct date format?
PostPosted: January 10th, 2006, 3:11 pm 
Offline

Joined: October 25th, 2004, 1:21 pm
Posts: 424
Location: West Lancs, UK
Opus: 7
OS: Xp, Win7
I'm tring to use a system variable to display the date. I want the format to be 'January 2005' or '10th January 2005'

SYSTEM_DATE_FULL gives me '10 January 2005' while

SYSTEM_TIME_MONTH gives me 'Jan'

Is there another system variable that gives me what I want, or do I have to put in an additional variable to change Jan to January? (... and all the other months...)

_________________
Linda Rossiter, Rossiter & Co

Pro 8, Pro 7, Pro 6, Pro 05.5XE, Pro 04XE, XE2.8, ILM 4.5 on Win7 Professional


Top
 Profile Visit website  
 
 Post subject:
PostPosted: January 10th, 2006, 5:30 pm 
Offline

Joined: November 11th, 2004, 1:43 pm
Posts: 172
Location: Buckinghamshire, UK
Could use SYSTEM_DATE_FULL, saving the returned value to a variable and "splitting" it up as required

i.e.
var MAXWELL = SYSTEM_DATE_FULL
in this case MAXWELL is "10 January 2006"

var myArray = MAXWELL.split(" ")

to get "January 2006", you need myArray[1] and myArray[2]

MAXWELL = myArray[1] + " " + myArray[2]

Debug.trace("my date: MAXWELL passed through split :" + MAXWELL +"\n")


Top
 Profile  
 
 Post subject:
PostPosted: January 10th, 2006, 5:46 pm 
Offline

Joined: October 25th, 2004, 12:32 pm
Posts: 397
Location: Digital Workshop
Great minds think alike.

Regards

Brenden

Similar example attached.


You do not have the required permissions to view the files attached to this post.


Top
 Profile Visit website  
 
 Post subject: Formatted Date
PostPosted: January 11th, 2006, 3:38 am 
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
As always with OPUS, there are multiple ways to achieve similar things.

Your coding is too complicated for me. I just create a Variable called MONTH then under Programming use SELECT = SYSTEM_TIME_MONTH plus a CASE Action which lists "Jan" and under it sets MONTH to "January"; Feb sets MONTH = February; etc.

There are only twelve months, plus once you create this, you can save it into a Gallery for future use. You also could create 12 IF Statements if CASE is too difficult. Once you use SELECT and CASE, you'll find lots of other uses as well.

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


Top
 Profile Visit website  
 
 Post subject:
PostPosted: January 12th, 2006, 11:35 am 
Offline

Joined: October 25th, 2004, 1:21 pm
Posts: 424
Location: West Lancs, UK
Opus: 7
OS: Xp, Win7
Fred, that's great... you're right, the other solution was Greek to me.

One query... I know that System_Time_month gives me Jan ... other than changing my pc clock and running the programme eleven more times, how do I find what it gives for the other months?

Is it always just the first three letters?

Thanks, Linda

_________________
Linda Rossiter, Rossiter & Co

Pro 8, Pro 7, Pro 6, Pro 05.5XE, Pro 04XE, XE2.8, ILM 4.5 on Win7 Professional


Top
 Profile Visit website  
 
 Post subject:
PostPosted: January 12th, 2006, 11:49 am 
Offline

Joined: October 25th, 2004, 1:21 pm
Posts: 424
Location: West Lancs, UK
Opus: 7
OS: Xp, Win7
It's OK... I changed the pc date and ran it twelve times.

The answer is that yes, it's always the first three letters.

I shouldn't have left Outlook open as I changed the month though, as I ended up with a load of reminder popups for events throughout the year, before it crashed in style!

Ah well, you learn something every day....

Now; to get the day from saying '2' to '2nd'... I guess I just follow the same principle another 31 times?

_________________
Linda Rossiter, Rossiter & Co

Pro 8, Pro 7, Pro 6, Pro 05.5XE, Pro 04XE, XE2.8, ILM 4.5 on Win7 Professional


Top
 Profile Visit website  
 
 Post subject: Day Format
PostPosted: January 12th, 2006, 2:10 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
Linda --

Yes, you can change "1" to "1st" and "2" to "2nd" using the same SELECT and CASE concept. Each month is initially captured as just the first three characters of the full month's name (e.g July is Jul).

Once you have the corrected elements, you can either create another text variable and assemble the variables (Set TODAY_DATE=DAY + " " + MONTH + " " + SYSTEM_TIME_YEAR gives "12th January 2006"); or just do it "on the fly" within a Text Object ("Today is <DAY> <MONTH> <SYSTEM_TIME_YEAR"). It depends how often you are using the re-formated information. I'd set it to a new varialbe (TODAY_DATE) if I was re-using it often.

Again, once you've done all this work, you can save your work and re-use it in the future.

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


Top
 Profile Visit website  
 
 Post subject:
PostPosted: January 12th, 2006, 2:27 pm 
Offline

Joined: October 26th, 2004, 1:26 pm
Posts: 262
Hi Fred,

Isn't Opus fantastic!! :D -- There are so many ways to get the same result and as you say, it can be done with NO SCRIPTING, however I mocked up this 'script' version for yet another way at doing it....
(Scripting experts may cringe at my script)


Linda --

Here's some basic scripting (sorry) :roll: -- but you may be able to follow it. ;)

See attached IMP.


You do not have the required permissions to view the files attached to this post.

_________________
Cheers,
Steve


Last edited by Steve H on January 13th, 2006, 2:11 am, edited 1 time in total.

Top
 Profile  
 
 Post subject:
PostPosted: January 12th, 2006, 3:41 pm 
Offline

Joined: October 25th, 2004, 1:21 pm
Posts: 424
Location: West Lancs, UK
Opus: 7
OS: Xp, Win7
Steve,

That's the best answer so far, as it doesn't require me to do any work!!!

I'd actually abandoned the date idea an hour or so ago.... having set up all the select case stuff in a separate pub, and tested it until perfect, when I combined it into the large pub I'm working on I got rather odd results.... no doubt I could have fixed it with another hour's snagging, but I'd spent too much time on it already.

However, the insertion of your script and a new variable, and it's working perfectly now... many thanks.

I'll be back with the next problem shortly..... !

_________________
Linda Rossiter, Rossiter & Co

Pro 8, Pro 7, Pro 6, Pro 05.5XE, Pro 04XE, XE2.8, ILM 4.5 on Win7 Professional


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

All times are UTC [ DST ]


Who is online

Users browsing this forum: Google [Bot] and 63 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