Re: System Date/Time Format Problems

2011-07-05 Thread Pete
Thanks Ken, I figured that's what it was.  I can send you the changed
handler if you're interested n the ordinal day and timezone (timezone will
only work on a Mac).

Pete
Molly's Revenge 




On Tue, Jul 5, 2011 at 6:03 PM, Ken Ray  wrote:

>
>
> > I notice there are less characters (26) in tReplaceChars than there are
> > items in tFormatWords (28) and the handler code suggests that there
> should
> > be the same number of characters. I'd like to add a couple more formats
> > (ordinal day number and 3-char time zone) and want to make sure I
> understand
> > the relationship between those two variables before changing anything.
>
> Good catch! You're right - that's a bug... there should be 28. I should
> probably come up with a better way of handling the replacement...
>
> For now, you can add a couple of characters to tReplaceChars and it should
> work...
>
> Ken Ray
> Sons of Thunder Software, Inc.
> Email: k...@sonsothunder.com
> Web Site: http://www.sonsothunder.com/
>
>
>
> ___
> use-livecode mailing list
> use-livecode@lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>
>
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: System Date/Time Format Problems

2011-07-05 Thread Ken Ray


> I notice there are less characters (26) in tReplaceChars than there are
> items in tFormatWords (28) and the handler code suggests that there should
> be the same number of characters. I'd like to add a couple more formats
> (ordinal day number and 3-char time zone) and want to make sure I understand
> the relationship between those two variables before changing anything.

Good catch! You're right - that's a bug... there should be 28. I should
probably come up with a better way of handling the replacement...

For now, you can add a couple of characters to tReplaceChars and it should
work...

Ken Ray
Sons of Thunder Software, Inc.
Email: k...@sonsothunder.com
Web Site: http://www.sonsothunder.com/



___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: System Date/Time Format Problems

2011-07-05 Thread Pete
Ken,
Thanks for this.  I've been trying it out and all seems to work great.

I notice there are less characters (26) in tReplaceChars than there are
items in tFormatWords (28) and the handler code suggests that there should
be the same number of characters. I'd like to add a couple more formats
(ordinal day number and 3-char time zone) and want to make sure I understand
the relationship between those two variables before changing anything.

Thanks,

Pete
Molly's Revenge 




On Mon, Jul 4, 2011 at 6:24 AM, Ken Ray  wrote:

> I have a handler I've been using for a while that works great with
> formatting dates. Here it is (sorry for the length, but it's heavily
> commented - oh and watch for word wraps):
>
>
>
> ___
> use-livecode mailing list
> use-livecode@lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>
>
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: System Date/Time Format Problems

2011-07-04 Thread Pete
Thanks a lot Ken, this looks great and I'll be trying it out very soon.  I
might add the ability to return the 3-char timezone since I just found out
how to get hold of that from OS X (it's in word -2 of the shell date
command)
Pete
Molly's Revenge 




On Mon, Jul 4, 2011 at 6:24 AM, Ken Ray  wrote:

> I have a handler I've been using for a while that works great with
> formatting dates. Here it is (sorry for the length, but it's heavily
> commented - oh and watch for word wraps):
>
>
>
>
>
> ___
> use-livecode mailing list
> use-livecode@lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>
>
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: System Date/Time Format Problems

2011-07-04 Thread Ken Ray
I have a handler I've been using for a while that works great with
formatting dates. Here it is (sorry for the length, but it's heavily
commented - oh and watch for word wraps):

--
--| FUNCTION: stsFormattedDate
--|
--| Author:   Ken Ray
--| Version:  2.6
--| Created:  8/2/04
--| Last Mod: 2/8/11
--| Requires: --
--|
--| Formats an incoming date according to a variety of date
--| patterns and outputs the result.
--|
--| Parameters:
--| : The date to be formatted. Must be a date or
--|   date/time combination,  or empty. If empty, uses the
--|   current date and default 2AM time if time is
--|   requested in the pattern. Will also check to see if the
--|   date is a mySQL-formatted
--|   date if it can't be identified as a "normal" date.
--| : The pattern to use to format the incoming date.
--|   The following patterns are available where "M" is used for
--|   the month, "D" for the day, "Y" for the year, "W" for
--|   the weekday name, "H" for hours, "P" for AM/PM,
--|   "N" for minutes, "S" for seconds, and "G" for GMT
--|   calculation, as follows:
--|M = month number, no leading zeroes (1-12)
--|MM = month number, with leading zeroes (01-12)
--|MMM = month name, abbreviated (Jan - Dec)
--| = month name, long (January - December)
--|D = day number, no leading zeroes (1-31)
--|DD = day number, with leading zeroes (01-31)
--|W = weekday name, single letter (S/M/T/W/t/F/s)
--|WW = weekday name, shortest (Su/M/Tu/W/Th/F/Sa)
--|WWW = weekday name, abbreviated (Sun/Mon/Tue/Wed/
--| Thu/Fri/Sat)
--| = weekday name, long (Sunday/Monday/Tuesday/etc.)
--|YY = two-digit year (00-99)
--| = four digit year (1970-2004)
--|H = hours, no leading zeroes, 12 hour format (1-12)
--|HH = hours, leading zeroes, 12 hour format (01-12)
--|HHH = hours, no leading zeroes, 24 hour format (1-23)
--| = hours, leading zeroes, 24 hour format (01-23)
--|H = military time format ( - 2359)
--|P = AM/PM, single character, lower case (a/p)
--|PP = AM/PM, single character, upper case (A/P)
--|PPP = AM/PM, two characters, lower case (am/pm)
--| = AM/PM, two characters, upper case (AM/PM)
--|N = minutes, no leading zeroes (0-59)
--|NN = minutes, leading zeroes (00-59)
--|S = seconds, no leading zeroes (0-59)
--|SS = seconds, leading zeroes (00-59)
--|G = GMT Offset (-1100 to +1100)
--|GH = GMT Offset hours, including sign (-11 to +11)
--|GM = GMT Offset minutes
--| : Determines whether or not the format needs to
--|   have brackets surrounding each part of the pattern. If true,
--|   it requires that all patterns are surrounded by square
--|   brackets, and allows the letters used in the pattern
--|   (MDYWHNSGP) to be used as part of the return string that
--|   is *not* part of the pattern (for example "GMT" as a string).
--|   If false, pattern letters are replaced by the corresponding
--|   date parts in the returned string (so it assumes that
--|   characters that are not part of the pattern are not letters,
--|   but symbols).
--
function stsFormattedDate pDate,pFormat,pUseBrackets
  if (pDate = "") or (pDate = "Now") then put the date && the long time into
pDate
  if (pFormat = "") then put "MM/DD/" into pFormat
  if isNumber(word -1 of pDate) then
if (word -1 of pDate <=2359) and (length(word -1 of pDate)=4) then
  -- date and military time sent in, just needs a colon between
  -- hour and minute for it to be converted
  put ":" before char -2 of pDate
else
  -- simple number, coerce to AM
  if word -1 of pDate <= 12 then
put ((word -1 of pDate) & ":00 AM") into word -1 of pDate
  else
-- a number larger than 12 but not military? Can't do anything
-- with that
return "invalid time"
  end if
end if
  end if
  
  -- Check for am/pm without preceding space
  put word -1 of pDate into tTestTime
  if (tTestTime <> "AM") and (tTestTime <> "PM") then
put offset("a",tTestTime) into tLoc
if (tLoc <> 0) and (char (tLoc-1) of pDate <> " ") then
  if char (tLoc+1) of tTestTime <> "m" then put "m" after \
 char tLoc of tTestTime
  put " " before char tLoc of tTestTime
  put word -2 of tTestTime into tTime
  if ":"is not in tTime then
-- probably someth

Re: System Date/Time Format Problems

2011-07-03 Thread Pete
I think I only described item 2 as a bug (and it definitely is).  Item 1 is
an enhancement request and item 3, who knows - it's  an "inconsistency",
which is not good.  New formats would be fine with me if they fix the
issues.

No doubt the mothership will categorise them however they see fit and take
the appropriate action.  Since they seem to be 99% focused on mobile
platforms right now (probably correctly), I'm not holding my breath for any
of them to be fixed any time soon.

Pete
Molly's Revenge 




On Sun, Jul 3, 2011 at 7:01 PM, J. Landman Gay wrote:

> On 7/3/11 4:58 PM, Pete wrote:
>
>> I think I already mentioned this but I've entered QC report number 9604
>> about all this.  There's various problems involved:
>>
>> 1) LC needs one more keyword so it can deal with the 4 date/time formats
>> used by OS X.
>> 2) There's a bug in the "abbrev system time" - it returns LC's default
>> abbrev format, not the format in any of the OS X user preferences.
>> 3) There's an inconsistency between the long system date and the long
>> system
>> time - the date returned is in the OS X full format, and the time is in
>> the
>> OS X medium format.
>>
>> These issues occur anywhere you refer to system dates and times, including
>> the convert command.
>>
>
> They aren't bugs, they're legacy formats that go back 20 years, and
> changing them would break a lot of stacks. When these date/time formats were
> implemented they matched the ones in Mac OS 6 and 7, and probably still
> matched in OS 9, though I don't remember.
>
> So rather than changing those, we should get new formats that represent
> more modern system options. This would be a feature request, so it would be
> good to update your report to reflect that.
>
>
> --
> Jacqueline Landman Gay | jac...@hyperactivesw.com
> HyperActive Software   | http://www.hyperactivesw.com
>
> __**_
> use-livecode mailing list
> use-livecode@lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/**mailman/listinfo/use-livecode
>
>
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: System Date/Time Format Problems

2011-07-03 Thread J. Landman Gay

On 7/3/11 4:58 PM, Pete wrote:

I think I already mentioned this but I've entered QC report number 9604
about all this.  There's various problems involved:

1) LC needs one more keyword so it can deal with the 4 date/time formats
used by OS X.
2) There's a bug in the "abbrev system time" - it returns LC's default
abbrev format, not the format in any of the OS X user preferences.
3) There's an inconsistency between the long system date and the long system
time - the date returned is in the OS X full format, and the time is in the
OS X medium format.

These issues occur anywhere you refer to system dates and times, including
the convert command.


They aren't bugs, they're legacy formats that go back 20 years, and 
changing them would break a lot of stacks. When these date/time formats 
were implemented they matched the ones in Mac OS 6 and 7, and probably 
still matched in OS 9, though I don't remember.


So rather than changing those, we should get new formats that represent 
more modern system options. This would be a feature request, so it would 
be good to update your report to reflect that.


--
Jacqueline Landman Gay | jac...@hyperactivesw.com
HyperActive Software   | http://www.hyperactivesw.com

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: System Date/Time Format Problems

2011-07-03 Thread Pete
I think I already mentioned this but I've entered QC report number 9604
about all this.  There's various problems involved:

1) LC needs one more keyword so it can deal with the 4 date/time formats
used by OS X.
2) There's a bug in the "abbrev system time" - it returns LC's default
abbrev format, not the format in any of the OS X user preferences.
3) There's an inconsistency between the long system date and the long system
time - the date returned is in the OS X full format, and the time is in the
OS X medium format.

These issues occur anywhere you refer to system dates and times, including
the convert command.

Jacque - thanks for your code - it works pretty well for standard US
settings, as you said, but it doesn't help if the user has customised the
System Preferences date and time formats or if they are not using US
formats.  My objective is to allow the user to tell me that dates are to be
displayed in any one of the System Preference settings (or set a custom one
of their own).  I've figured out how to get the user's System Preference
settings from a combination of the shell locale command and an Applescript
and am busy writing a handler to format dates accordingly.

Pete
Molly's Revenge 




On Sun, Jul 3, 2011 at 11:14 AM, Pete  wrote:

> Thanks Jacque, that's a great start.  I also found the dateFormat function
> which I think may assist in all this.
> Pete
> Molly's Revenge 
>
>
>
>
> On Sat, Jul 2, 2011 at 8:15 PM, J. Landman Gay 
> wrote:
>
>> On 7/2/11 2:46 PM, Pete wrote:
>>
>>  So if a user tells me he wants his dates in OS X medium or long format, I
>>> can't find out what that is with LC code, same for an OS X long time.
>>>
>>
>> Start with these. The functions below will only work on US systems, or in
>> countries that use US date/time formats. If you want to accomodate other
>> countries you'll have to do more work.
>>
>> The "lookupZone" function is for the long and full time formats. I have
>> exactly one entry in there for central time. What you need to do for that is
>> make a list of all the time zones, one per line, in the same order my
>> example uses. Store it in a custom property or somewhere. Retrieve the list
>> for the lookup function.
>>
>> There may be a shell call to do that, or a list stored somewhere in OS X.
>> I don't know. Anyway, maybe this will get you started:
>>
>> function formatDate pDate,pFormat -- short, medium, long, full
>>  switch pFormat
>>case "short"
>>  convert pDate to short date
>>  put pDate into tFormattedDate
>>  break
>>case "medium"
>>  convert pDate to abbrev date
>>  put item 2 to -1 of pDate into tFormattedDate
>>  break
>>case "long"
>>  convert pDate to long date
>>  put item 2 to -1 of pDate into tFormattedDate
>>  break
>>case "full"
>>  convert pDate to long date
>>  put pDate into tFormattedDate
>>  break
>>  end switch
>>  return tFormattedDate
>> end formatDate
>>
>> function formatTime pTime,pFormat
>>  switch pFormat
>>case "short"
>>  convert pTime to short time
>>  put pTime into tFormattedTime
>>  break
>>case "medium"
>>  convert pTime to long time
>>  put pTime into tFormattedTime
>>  break
>>case "long"
>>case "full"
>>  convert pTime to long time
>>  put pTime into tFormattedTime
>>  convert pTime to internet date
>>  put word 6 of pTime into tTimeZone
>>  put lookupZone(tTimeZone) into tZoneInfo
>>  if pFormat = "long" then
>>put item 2 of tZoneInfo into tTimeZone
>>  else -- full
>>put item 3 of tZoneInfo into tTimeZone
>>  end if
>>  put space & tTimeZone after tFormattedTime
>>  break
>>  end switch
>>  return tFormattedTime
>> end formatTime
>>
>> function lookupZone pHourOffset
>>  -- need a list in this format, one line per zone:
>>  put "-0500,CST,CT" into tZones
>>  return line lineoffset(pHourOffset,tZones) of tZones
>> end lookupZone
>>
>>
>> --
>> Jacqueline Landman Gay | jac...@hyperactivesw.com
>> HyperActive Software   | http://www.hyperactivesw.com
>>
>> __**_
>> use-livecode mailing list
>> use-livecode@lists.runrev.com
>> Please visit this url to subscribe, unsubscribe and manage your
>> subscription preferences:
>> http://lists.runrev.com/**mailman/listinfo/use-livecode
>>
>>
>
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: System Date/Time Format Problems

2011-07-03 Thread Pete
Thanks Jacque, that's a great start.  I also found the dateFormat function
which I think may assist in all this.
Pete
Molly's Revenge 




On Sat, Jul 2, 2011 at 8:15 PM, J. Landman Gay wrote:

> On 7/2/11 2:46 PM, Pete wrote:
>
>  So if a user tells me he wants his dates in OS X medium or long format, I
>> can't find out what that is with LC code, same for an OS X long time.
>>
>
> Start with these. The functions below will only work on US systems, or in
> countries that use US date/time formats. If you want to accomodate other
> countries you'll have to do more work.
>
> The "lookupZone" function is for the long and full time formats. I have
> exactly one entry in there for central time. What you need to do for that is
> make a list of all the time zones, one per line, in the same order my
> example uses. Store it in a custom property or somewhere. Retrieve the list
> for the lookup function.
>
> There may be a shell call to do that, or a list stored somewhere in OS X. I
> don't know. Anyway, maybe this will get you started:
>
> function formatDate pDate,pFormat -- short, medium, long, full
>  switch pFormat
>case "short"
>  convert pDate to short date
>  put pDate into tFormattedDate
>  break
>case "medium"
>  convert pDate to abbrev date
>  put item 2 to -1 of pDate into tFormattedDate
>  break
>case "long"
>  convert pDate to long date
>  put item 2 to -1 of pDate into tFormattedDate
>  break
>case "full"
>  convert pDate to long date
>  put pDate into tFormattedDate
>  break
>  end switch
>  return tFormattedDate
> end formatDate
>
> function formatTime pTime,pFormat
>  switch pFormat
>case "short"
>  convert pTime to short time
>  put pTime into tFormattedTime
>  break
>case "medium"
>  convert pTime to long time
>  put pTime into tFormattedTime
>  break
>case "long"
>case "full"
>  convert pTime to long time
>  put pTime into tFormattedTime
>  convert pTime to internet date
>  put word 6 of pTime into tTimeZone
>  put lookupZone(tTimeZone) into tZoneInfo
>  if pFormat = "long" then
>put item 2 of tZoneInfo into tTimeZone
>  else -- full
>put item 3 of tZoneInfo into tTimeZone
>  end if
>  put space & tTimeZone after tFormattedTime
>  break
>  end switch
>  return tFormattedTime
> end formatTime
>
> function lookupZone pHourOffset
>  -- need a list in this format, one line per zone:
>  put "-0500,CST,CT" into tZones
>  return line lineoffset(pHourOffset,tZones) of tZones
> end lookupZone
>
>
> --
> Jacqueline Landman Gay | jac...@hyperactivesw.com
> HyperActive Software   | http://www.hyperactivesw.com
>
> __**_
> use-livecode mailing list
> use-livecode@lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/**mailman/listinfo/use-livecode
>
>
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: System Date/Time Format Problems

2011-07-02 Thread J. Landman Gay

On 7/2/11 2:46 PM, Pete wrote:


So if a user tells me he wants his dates in OS X medium or long format, I
can't find out what that is with LC code, same for an OS X long time.


Start with these. The functions below will only work on US systems, or 
in countries that use US date/time formats. If you want to accomodate 
other countries you'll have to do more work.


The "lookupZone" function is for the long and full time formats. I have 
exactly one entry in there for central time. What you need to do for 
that is make a list of all the time zones, one per line, in the same 
order my example uses. Store it in a custom property or somewhere. 
Retrieve the list for the lookup function.


There may be a shell call to do that, or a list stored somewhere in OS 
X. I don't know. Anyway, maybe this will get you started:


function formatDate pDate,pFormat -- short, medium, long, full
  switch pFormat
case "short"
  convert pDate to short date
  put pDate into tFormattedDate
  break
case "medium"
  convert pDate to abbrev date
  put item 2 to -1 of pDate into tFormattedDate
  break
case "long"
  convert pDate to long date
  put item 2 to -1 of pDate into tFormattedDate
  break
case "full"
  convert pDate to long date
  put pDate into tFormattedDate
  break
  end switch
  return tFormattedDate
end formatDate

function formatTime pTime,pFormat
  switch pFormat
case "short"
  convert pTime to short time
  put pTime into tFormattedTime
  break
case "medium"
  convert pTime to long time
  put pTime into tFormattedTime
  break
case "long"
case "full"
  convert pTime to long time
  put pTime into tFormattedTime
  convert pTime to internet date
  put word 6 of pTime into tTimeZone
  put lookupZone(tTimeZone) into tZoneInfo
  if pFormat = "long" then
put item 2 of tZoneInfo into tTimeZone
  else -- full
put item 3 of tZoneInfo into tTimeZone
  end if
  put space & tTimeZone after tFormattedTime
  break
  end switch
  return tFormattedTime
end formatTime

function lookupZone pHourOffset
  -- need a list in this format, one line per zone:
  put "-0500,CST,CT" into tZones
  return line lineoffset(pHourOffset,tZones) of tZones
end lookupZone

--
Jacqueline Landman Gay | jac...@hyperactivesw.com
HyperActive Software   | http://www.hyperactivesw.com

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: System Date/Time Format Problems

2011-07-02 Thread J. Landman Gay

On 7/2/11 2:46 PM, Pete wrote:


For dates:
LC Short = OSX Short
LC Long = OSX Full
LC Abbrev = returns a date that is not in any of the OS X formats
no LC format for OSX medium or long


For times:
LC Short = OSX Short
LC Abbrev = OSX Short
LC Long = OSX Medium
no LC format for OSX Long or full

So if a user tells me he wants his dates in OS X medium or long format, I
can't find out what that is with LC code, same for an OS X long time.  I'm
hoping I will be able get hold of all the date/time formats with a shell
command or with Applescript but no luck yet.  I may have to ask the user to
define the formats again with my ap ( that goes back to the other thread
about duplicate object names!)


All I meant was that you already have most of them, and the ones that 
are missing are easy to construct. LiveCode provides all the data. For 
the LC formats that have no OS X equivalent, just don't use those. A 
quick function to construct the ones you do need would be pretty easy.


--
Jacqueline Landman Gay | jac...@hyperactivesw.com
HyperActive Software   | http://www.hyperactivesw.com

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: System Date/Time Format Problems

2011-07-02 Thread Pete
Thanks Jacque.  You may have missed the original post in this thread, so
here's a quick recap.

I want the user to be able to set a preference that he/she wants his
dates/times/displayed in any of the OS X formats of short, medium, long, and
full that are set in the OS X System Prefernces.  The problem is that the
Livecode system date formats don't fully reflect the system preference
settings on OS X (don't know about Windows).  Some of that is because OS X
has four date/time formats and LC only has three, but there's at least one
instance where LC returns a date that is not in any of the OS X date
formats.  Here's a summary of what happens on my Mac running OS X 10.6.8:

For dates:
LC Short = OSX Short
LC Long = OSX Full
LC Abbrev = returns a date that is not in any of the OS X formats
no LC format for OSX medium or long


For times:
LC Short = OSX Short
LC Abbrev = OSX Short
LC Long = OSX Medium
no LC format for OSX Long or full

So if a user tells me he wants his dates in OS X medium or long format, I
can't find out what that is with LC code, same for an OS X long time.  I'm
hoping I will be able get hold of all the date/time formats with a shell
command or with Applescript but no luck yet.  I may have to ask the user to
define the formats again with my ap ( that goes back to the other thread
about duplicate object names!)

Pete
Molly's Revenge 




On Sat, Jul 2, 2011 at 9:37 AM, J. Landman Gay wrote:

> On 7/2/11 11:16 AM, Pete wrote:
>
>  But Im still faced with the problem of figuring out what the user's System
>> Preference settings are for the short, medium, long, and full date and
>> time
>> formats.
>>
>
> You can get their preferred format by either setting the usesystemdate to
> true and then getting a date or time, or just by getting "the system date".
> Then all the LiveCode date formats will reflect the user preference. For the
> abbrev date, where the month is not fully expanded, a quick lookup in the
> monthnames would fix that. Just replace the abbreviated month name with the
> expanded one.
>
> --
> Jacqueline Landman Gay | jac...@hyperactivesw.com
> HyperActive Software   | http://www.hyperactivesw.com
>
>
> __**_
> use-livecode mailing list
> use-livecode@lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/**mailman/listinfo/use-livecode
>
>
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: System Date/Time Format Problems

2011-07-02 Thread J. Landman Gay

On 7/2/11 11:16 AM, Pete wrote:


But Im still faced with the problem of figuring out what the user's System
Preference settings are for the short, medium, long, and full date and time
formats.


You can get their preferred format by either setting the usesystemdate 
to true and then getting a date or time, or just by getting "the system 
date". Then all the LiveCode date formats will reflect the user 
preference. For the abbrev date, where the month is not fully expanded, 
a quick lookup in the monthnames would fix that. Just replace the 
abbreviated month name with the expanded one.


--
Jacqueline Landman Gay | jac...@hyperactivesw.com
HyperActive Software   | http://www.hyperactivesw.com

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: System Date/Time Format Problems

2011-07-02 Thread Pete
Thanks Peter.  This and the strftime shell command will save me a lot of
time in formatting dates in LC!

But Im still faced with the problem of figuring out what the user's System
Preference settings are for the short, medium, long, and full date and time
formats.  I want to give them a preference that will allow them to set one
of those options for how they want dates/times displayed in my app, or have
a custom option that allows them to specify another format using the
date/strftime format strings conventions.

Incidentally, I added a problem report to the QC regarding the issues with
the various forms of the LC system date compared with the OS X system date
formats.

Pete
Molly's Revenge 




On Sat, Jul 2, 2011 at 5:43 AM, Peter Brigham MD  wrote:

> There may be a better way, but you might have to use a shell call. Execute
> the following in the message box:
>
>   put shell("man date | col -b")
>
> and look at the options. You can get any format you want, and this way you
> would have full control over date display format in LC.
>
> -- Peter
>
> Peter M. Brigham
> pmb...@gmail.com
> http://home.comcast.net/~pmbrig
>
> On Jul 1, 2011, at 1:59 PM, Pete wrote:
>
> > I'm running into some major differences in the way LC displays system
> date
> > and time versus what I have set up in my OSX control panel and wondering
> if
> > anyone else has run into this.  This is in the context of providing my
> users
> > with a preference setting for how they want dates/times displayed.
> >
> > First problem is that OSX has 4 date and time formats (Short, Medium,
> Long,
> > and Full) whereas LC only has three (Short, Abbrev, Long) so there are
> some
> > inevitable discrepancies.
> >
> > For dates:
> > LC Short = OSX Short
> > LC Long = OSX Full
> > LC Abbrev = no OSX format
> > no LC format = OSX medium or long
> >
> >
> > For times:
> > LC Short = OSX Short
> > LC Abbrev = OSX Short
> > LC Long = OSX Medium
> > no LC format = OSX Long or full
> >
> > Any thoughts?
> >
> > Pete
> > Molly's Revenge 
> > ___
> > use-livecode mailing list
> > use-livecode@lists.runrev.com
> > Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> > http://lists.runrev.com/mailman/listinfo/use-livecode
>
>
> ___
> use-livecode mailing list
> use-livecode@lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>
>
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: System Date/Time Format Problems

2011-07-02 Thread Peter Brigham MD
There may be a better way, but you might have to use a shell call. Execute the 
following in the message box:

   put shell("man date | col -b")

and look at the options. You can get any format you want, and this way you 
would have full control over date display format in LC.

-- Peter

Peter M. Brigham
pmb...@gmail.com
http://home.comcast.net/~pmbrig

On Jul 1, 2011, at 1:59 PM, Pete wrote:

> I'm running into some major differences in the way LC displays system date
> and time versus what I have set up in my OSX control panel and wondering if
> anyone else has run into this.  This is in the context of providing my users
> with a preference setting for how they want dates/times displayed.
> 
> First problem is that OSX has 4 date and time formats (Short, Medium, Long,
> and Full) whereas LC only has three (Short, Abbrev, Long) so there are some
> inevitable discrepancies.
> 
> For dates:
> LC Short = OSX Short
> LC Long = OSX Full
> LC Abbrev = no OSX format
> no LC format = OSX medium or long
> 
> 
> For times:
> LC Short = OSX Short
> LC Abbrev = OSX Short
> LC Long = OSX Medium
> no LC format = OSX Long or full
> 
> Any thoughts?
> 
> Pete
> Molly's Revenge 
> ___
> use-livecode mailing list
> use-livecode@lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription 
> preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


System Date/Time Format Problems

2011-07-01 Thread Pete
I'm running into some major differences in the way LC displays system date
and time versus what I have set up in my OSX control panel and wondering if
anyone else has run into this.  This is in the context of providing my users
with a preference setting for how they want dates/times displayed.

First problem is that OSX has 4 date and time formats (Short, Medium, Long,
and Full) whereas LC only has three (Short, Abbrev, Long) so there are some
inevitable discrepancies.

For dates:
LC Short = OSX Short
LC Long = OSX Full
LC Abbrev = no OSX format
no LC format = OSX medium or long


For times:
LC Short = OSX Short
LC Abbrev = OSX Short
LC Long = OSX Medium
no LC format = OSX Long or full

Any thoughts?

Pete
Molly's Revenge 
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode