Just FYI, I think the dictionary is wrong or misleading in respect of what the 
dateItems does. If you script this in the LC Message Box:

put the date into t1
convert t1 to dateItems
put t1

You get, e.g.
2020,10,29,0,0,0,5


but if you script

put the english time into t1
convert t1 to dateItems
put t1

You get e.g.
2020,10,29,11,40,0,5

i.e if you specify the date, you only get the date; but if you specify the 
time, you get the date thrown in. I could not deduce this from the Dictionary, 
but maybe I am just poor at reading what it says.

Graham

> On 29 Oct 2020, at 09:29, Graham Samuel via use-livecode 
> <use-livecode@lists.runrev.com> wrote:
> 
> Thanks Tore - I had forgotten the existence of dateItems. That of course will 
> do the trick. BTW I was trying to create dates in standard UTC format, and 
> now I can.
> 
> Graham
> 
>> On 28 Oct 2020, at 23:18, Tore Nilsen via use-livecode 
>> <use-livecode@lists.runrev.com> wrote:
>> 
>> You can convert any given date to dateItems. Then you can use dateItems to 
>> present the date in any format you like. A date converted to dateItems will 
>> give you the following list of items: 
>> 
>> the year
>> the month number
>> the day of the month
>> the hour in 24-hour time
>> the minute
>> the second
>> the numeric day of the week where Sunday is day 1, Monday is day 2, and so 
>> forth
>> All according to the Dictionary.
>> 
>> To be sure that any valid date format is recognized as a date when you read 
>> in the date you will like to convert, it is best to ask for the system date 
>> or set the useSystemDate to true, as this will make all valid date formats 
>> convert to dateItems.
>> 
>> Best regards
>> Tore Nilsen
>>> 28. okt. 2020 kl. 22:58 skrev Graham Samuel via use-livecode 
>>> <use-livecode@lists.runrev.com>:
>>> 
>>> A quick test seems to show that the DateFormat can’t be changed by a ‘set’ 
>>> command.
>>> 
>>> How then can I force a date to be in a given format? I’m really thinking of 
>>> the difference between US and European dates, i.e
>>> 
>>> d/m/y versus m/d/y
>>> 
>>> Obviously for some types of use, an LC program should be able to force the 
>>> format for consistency’s sake, regardless of where in the world it’s being 
>>> run.
>>> 
>>> Can it be done?
>>> 
>>> Graham
>>> _______________________________________________
>>> 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

_______________________________________________
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

Reply via email to