Convert date

Bob Sneidar bobsneidar at iotecdigital.com
Fri Jul 14 14:45:05 EDT 2023


Because I’m not that good with regular expressions and the format function. :-) But you example has one too many close parens. 

Also, for SQL Date I do not thing UK or US matters. It’s YYYY-MM-DD everywhere, isn’t it? 

Also, I assumed that the localization of the LC engine would take into account the local date format for the built in date functions. Is that incorrect? 

Bob S


> On Jul 14, 2023, at 11:39 AM, Alex Tweedly via use-livecode <use-livecode at lists.runrev.com> wrote:
> 
> 
> On 14/07/2023 16:34, Bob Sneidar via use-livecode wrote:
>>       CASE "sql date"
>>          put item 1 of theDate & "-" & \
>>             format("%02d",item 2 of theDate) & "-" & \
>>             format("%02d",item 3 of theDate) into theDate
>>          break
> 
> Why not just
> 
> put format("%s-%02d-%02d", item 1 of theDate, item 2 of theDate), \
>                           item 3 of theDate) into theDate
> 
> Alex.
> 
> btw - you forgot the if/switch check for
>    "if in the USA" vs "if in the UK" :-) :-)
> 
> 
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode



More information about the use-livecode mailing list