useSystemDate

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
exheusden
Posts: 170
Joined: Fri Oct 09, 2009 5:03 pm
Contact:

useSystemDate

Post by exheusden » Wed Oct 28, 2009 1:44 pm

My MacOS X (10.5.8) system dates are set to display in dd/mm/yyyy format, e.g.:

Monday, 5 January 2009
Monday, 5 January 2009
5 Jan 2009
05/01/2009

A stack contains the following in Basic Properties:

Code: Select all

on openStack
   
   set the useSystemDate to true
   
end openStack
Yet the following script, at field level, results in the American format of the date being put into the field "modified":

Code: Select all

on closeField
   if the short name of the target = "Notes" then exit closeField
   put the long English date into fld "modified"
end closeField
(also tried without the "English" -- same result)

In today's case, this is shown as "Wednesday, October 28, 2009"

How do I get this to show as "Wednesday, 28 October 2009"?

Klaus
Posts: 14191
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Post by Klaus » Wed Oct 28, 2009 1:57 pm

Hi exheusden,

"usesystemdate" is a local property!
That means you have to declare it in each handler where you need it:

Code: Select all

on closeField 
   set the useSystemDate to true
   if the short name of the target = "Notes" then exit closeField 
   put the long English date into fld "modified" 
end closeField
Best

Klaus

exheusden
Posts: 170
Joined: Fri Oct 09, 2009 5:03 pm
Contact:

Post by exheusden » Wed Oct 28, 2009 3:17 pm

That makes no difference, I'm afraid!

Edit: got it to work: not only must useSystemDate be set to true in rach handler, but the "English" must be left out. The following works:

Code: Select all

on closeField 
   set the useSystemDate to true 
   if the short name of the target = "Notes" then exit closeField 
   put the long date into fld "modified" 
end closeField
Thanks for your help.

Klaus
Posts: 14191
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Post by Klaus » Wed Oct 28, 2009 3:49 pm

Ah, yes, overlooked this one.

On the other hand directly using "put the system date..." might even save some scripting in that case :-)

Best

Klaus

exheusden
Posts: 170
Joined: Fri Oct 09, 2009 5:03 pm
Contact:

Post by exheusden » Wed Oct 28, 2009 4:29 pm

Ooh, that's a nice one to know!

Diolch yn fawr (thanks).

Post Reply