1. About Date Time

Thought some parties might be interested in this discussion:

     http://java.dzone.com/news/game-over-jdks-date-and-time-c

new topic     » topic index » view message » categorize

2. Re: About Date Time

c.k.lester wrote:
> 
> Thought some parties might be interested in this discussion:
> 
>      <a
>      href="http://java.dzone.com/news/game-over-jdks-date-and-time-c">http://java.dzone.com/news/game-over-jdks-date-and-time-c</a>

Thanks for the link. An interesting read. Here are some Euphoria 4.0 examples to
accomplish the same thing discussed there:

function isAfterPayDay(datetime dt)
  if dt[MONTH] = 2 then return dt[DAY] > 26 end if
  return dt[DAY] > 28
end function

function daysToNewYear(datetime fromDate)
  return diffSeconds(fromDate, new(fromDate[YEAR]+1, 1, 1,0,0,0)) / 86400)
end function

function isRentalOverdue(datetime due)
  datetime n
  n = now()
  n = add(n, 2, DAYS)
  n = add(n, 12, HOURS)
  return compare(due, n)
end function

function getBirthMonthText(datetime dt)
    return format(dt, "%A")
end function


BTW... If you've not used Java's date API's, the guys there are right when they
say " The existing classes are pretty bad—probably the worst APIs in the JDK.
They're buggy, mutable, cumbersome, many bugs, ..."

About intervals that they speak about. You can store intervals such as:
constant integer INT_DAYS = 86400
integer ten_days = INT_DAYS * 10

add(date, ten_days, SECONDS)

-- or
add(date, 10, DAYS)


Just a little heads up about the datetime support in 4.0

--
Jeremy Cowgar
http://jeremy.cowgar.com

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu