home *** CD-ROM | disk | FTP | other *** search
/ rtsi.com / 2014.01.www.rtsi.com.tar / www.rtsi.com / OS9 / OSK / APPS / lout2.lzh / LOUT2 / DOC / TR.LOUT / ch3.16 < prev    next >
Text File  |  1994-01-25  |  2KB  |  50 lines

  1. @Section
  2.    @Title { "@Moment" }
  3.    @Tag { moment }
  4. @Begin
  5. @PP
  6. The predefined symbol @@Moment
  7. moment.sym @Index { @@Moment symbol }
  8. has the following definition:
  9. @ID @Code {
  10. "def @Moment"
  11. "   named @Tag {}"
  12. "   named @Second {}"
  13. "   named @Minute {}"
  14. "   named @Hour {}"
  15. "   named @Day {}"
  16. "   named @Month {}"
  17. "   named @Year {}"
  18. "   named @Century {}"
  19. "   named @WeekDay {}"
  20. "   named @YearDay {}"
  21. "   named @DaylightSaving {}"
  22. "{}"
  23. }
  24. It may be used like any other symbol.  Lout provides an invocation of
  25. @@Moment with tag {@Code now}, whose other parameters are numbers
  26. encoding the current date and time:
  27. @ID {
  28. @JP @Code "@Second"  |0.5i the current second, between 0 and 59
  29. @JP @Code "@Minute"  | the current minute, between 0 and 59
  30. @JP @Code "@Hour"    | the current hour, between 0 and 23
  31. @JP @Code "@Day"     | the current day of the month, between 1 and 31
  32. @JP @Code "@Month"   | the current month, between 1 (January) and 12 (December)
  33. @JP @Code "@Year"    | the current year of the century, between 00 and 99
  34. @JP @Code "@Century" | the current century, e.g. 19 or 20
  35. @JP @Code "@WeekDay" | the current day of the week, between 1 (Sunday) and 7 (Saturday)
  36. @JP @Code "@YearDay" | the current day of the year, between 0 and 365
  37. @JP @Code "@DaylightSaving" | an implementation-dependent number that
  38. may encode the daylight saving currently in effect
  39. }
  40. date @Index { Date, printing of current }
  41. Judicious use of databases can convert
  42. these numbers into useful dates.  For example,
  43. @ID @Code {
  44. "@Moment&&now @Open { @Day {@Months&&@Month}, @Century{@Year} }"
  45. }
  46. produces something like
  47. @Moment&&now @Open { @Day {@Months&&@Month}, @Century{@Year} }
  48. given a suitable database of months.
  49. @End @Section
  50.