FYI: those interested in this date/time enhancement can add their
thoughts here:
http://quality.runrev.com/show_bug.cgi?id=4636
Bob Sneidar wrote:
Sorry about the extra lines in the last post. Not sure what caused that. Here
is the formatDate() function as well.
Bob S
function formatDate theDate, theFormat
/*
Accepts any valid date for the first parameter. If not a valid date, it
simply returns
what was passed. Second parameter can be any of the following:
sql date: date in the yyyy-mm-dd format
short date, abbreviated date, internet date, long date: LC versions of the
same
julian date: Julian number based on (I believe) Jacques formula)
*/
put the itemdelimiter into theOldDelim
set the itemdelimiter to "-"
if the length of item 1 of theDate = 4 and \
the number of items of theDate = 3 and \
item 1 of theDate is a number and \
item 2 of theDate is a number and \
item 3 of theDate is a number then
put item 2 of theDate& "/"& \
item 3 of theDate& "/"& \
item 1 of theDate into theDate
end if
convert theDate to dateitems
set the itemdelimiter to theOldDelim
switch theFormat
case "sql date"
put item 1 of theDate& "-"& \
format("%02d",item 2 of theDate)& "-"& \
format("%02d",item 3 of theDate) into theDate
break
case "short date"
convert theDate from dateitems to short date
break
case "abbreviated date"
convert theDate from dateitems to abbreviated date
break
case "internet date"
convert theDate from dateitems to internet date
break
case "long date"
convert theDate from dateitems to long date
break
case "julian date"
put the date into theDate
convert theDate to dateItems
if ((item 2 of theDate = 1) or (item 2 of theDate = 2)) then
put 1 into theDay
else
put 0 into theDay
end if
put item 1 of theDate + 4800 - theDay into theYear
put item 2 of theDate + (12 * theDay) - 3 into theMonth
put item 3 of theDate + \
((153 * theMonth + 2) div 5) + \
(365 * theYear) + \
(theYear div 4) - \
(theYear div 100) + \
(theYear div 400) - \
32045 into theDate
break
end switch
return theDate
end formatDate
On Jan 29, 2015, at 08:05 , Bob Sneidar<bobsnei...@iotecdigital.com> wrote:
Not that this solves your particular problem but some might be interested in
this function. I will see if I can include this scenario in my function at some
point.
Bob S
_______________________________________________
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