DateTime Library API - brombres/Rogue GitHub Wiki

Date.rogue

class Date [compound]

incorporates CommonCompoundMethods

Description

Uses algorithms from:
  http://www.herongyang.com/year/Program-Gregorian-Calendar-Algorithm.html

January 1, 2000 is stored as year=2000, month=1, day=1

Global Properties

Name Type Description
day_names String[]
month_names String[]
standard_days_in_month Int[]

Global Methods

Signature Return Type Description
create( date:String ) Date
create( year:Int, month:Int, day:Int ) Date
day_of_year( year:Int, month:Int, day:Int ) Int
days_in_month( year:Int, month:Int ) Int
days_in_year( year:Int ) Int
is_leap_year( year:Int ) Logical
mdy( month:Int, day:Int, year:Int ) Date
month_name_to_index( month_name:String ) Int January->1, December->12
 Accepts partial month names e.g. "Jan"
today() Date
ymd( year:Int, month:Int, day:Int ) Date

Properties

Name Type Description
day Int
month Int
year Int

Methods

Signature Return Type Description
day_name() String
day_of_week() Int Returns a value 0..6
day_of_year() Int Returns a day 0..364/365
days_in_month() Int
days_in_year() Int
decremented() Date
description() String
hashcode() Int
incremented() Date
month_name() String
operator+( days:Int ) Date
operator+( interval:DateInterval ) Date
operator-( days:Int ) Date
operator-( interval:DateInterval ) Date
operator-( other:Date ) Int Returns the number of days between the two dates
operator<>( other:Date ) Int For Dates the hash code contains all necessary info so we can use it to compare safely
operator==( other:Date ) Logical
print_to( buffer:PrintWriter )
to<<Object>>() Boxed<<Date>>
to<<String>>() String
to<<Variant>>() Variant
to<<String>>( [format="yyyy-mm-dd":String], &verbose ) String Format:
  yyyy - 4-digit year
  yy - 2-digit year
  mm - Month with leading 0 if necessary
  m - Month without any leading 0
  month - Month name spelled out
  mon - 3-letter month name
  dd - Day with leading 0 if necessary
  d - Day without any leading 0
type_info() TypeInfo
verbose() String

class DateInterval [compound]

incorporates CommonCompoundMethods

Global Methods

Signature Return Type Description
create( years:Int, months:Int, days:Int ) DateInterval
days( n:Int ) DateInterval
months( n:Int ) DateInterval
years( n:Int ) DateInterval

Properties

Name Type Description
days Int
months Int
years Int

Methods

Signature Return Type Description
description() String
operator+( date:Date ) Date
operator+( other:DateInterval ) DateInterval
operator-( other:DateInterval ) DateInterval
operator==( other:DateInterval ) Logical
print_to( buffer:PrintWriter )
to<<Object>>() Boxed<<DateInterval>>
to<<String>>() String
to<<Variant>>() Variant
type_info() TypeInfo

Time.rogue

class Time [compound]

incorporates CommonCompoundMethods

Global Methods

Signature Return Type Description
create( hour:Int, minute:Int, [second=0:Int], [millisecond=0:Int] ) Time
create( text:String ) Time
create( total_ms:Int64 ) Time
from_timestamp( timestamp:Timestamp ) Time
now() Time

Properties

Name Type Description
total_ms Int64

Methods

Signature Return Type Description
days() Int
description() String
hour() Int
is_am() Logical
is_pm() Logical
millisecond() Int
minute() Int
operator+( other:Time ) Time
operator-( other:Time ) Time
operator<>( other:Time ) Int64
operator==( other:Time ) Logical
print_to( buffer:PrintWriter )
second() Int
to<<Object>>() Boxed<<Time>>
to<<String>>() String
to<<Variant>>() Variant
to<<String>>( format:String ) String format
  hh24 - hour in 24-hour format with possible leading 0
  hh12 - hour in 12-hour format with possible leading 0
  hh - same as hh24
  h24 - hour in 24-hour format without any leading 0
  h12 - hour in 12-hour format without any leading 0
  h - same as h24
  mm - minutes with possible leading 0
  m - minutes without any leading 0
  ss - seconds with possible leading 0
  s - seconds without any leading 0
  ms - 3-digit milliseconds with possible leading 0's
  ampm - replaced with 'am' or 'pm' as appropriate
  AMPM - replaced with 'AM' or 'PM' as appropriate
  am/pm - replaced with 'am' or 'pm' as appropriate
  AM/PM - replaced with 'AM' or 'PM' as appropriate
  am - same as ampm
  pm - same as ampm
  AM - same as AMPM
  PM - same as AMPM
total_days() Real
total_hours() Real
total_minutes() Real
type_info() TypeInfo

TimeInterval.rogue

class TimeInterval [compound]

incorporates CommonCompoundMethods

Description

This time interval can be broken down into days, hours, minutes, seconds, and milliseconds. Those values are all independent and precise.

Global Methods

Signature Return Type Description
create( [flag=true:Logical], [days=0:Int64], [hours=0:Int64], [minutes=0:Int64], [seconds=0:Int64], [milliseconds=0:Int64] ) TimeInterval 'flag' is ignored and is a kludge to disambiguate the compound initializers from this global create method.
create( total_ms:Int64 ) TimeInterval
hms( hours:Real, minutes:Real, seconds:Real, [ms=0:Real] ) TimeInterval

Properties

Name Type Description
total_ms Int64

Methods

Signature Return Type Description
days() Int32
description() String
hours() Int32
is_negative() Logical
milliseconds() Int32
minutes() Int32
operator<>( other:TimeInterval ) Int64
operator==( other:TimeInterval ) Logical
print_to( buffer:PrintWriter )
seconds() Int32
to<<Object>>() Boxed<<TimeInterval>>
to<<String>>() String
to<<Variant>>() Variant
total_days() Real
total_hours() Real
type_info() TypeInfo

Timestamp.rogue

class Timestamp [compound]

incorporates CommonCompoundMethods

Global Properties

Name Type Description
month_names String[]
weekday_names String[]

Global Methods

Signature Return Type Description
create( [value=System.time:Real] ) Timestamp
create( date:Date, time:Time ) Timestamp
create( date:String ) Timestamp
create( year:Int, month:Int, day:Int, [hour=12:Int], [minute=0:Int], [second=0:Int], [millisecond=0:Int] ) Timestamp A year earlier than 1970 will result a date of 1969-12-31 on Mac at least. Therefore take the opportunity to adjust years < 100 to be prefixed with the current century, e.g. 19 -> 2019.
gmt_time_zone_offset() Int From: https://stackoverflow.com/a/44063597/135791
month_name_to_index( month_name:String ) Int January->1, December->12 Accepts partial month names e.g. "Jan"
now() Timestamp
ymd( year:Int, month:Int, day:Int ) Timestamp Use hour 12 instead of hour 0 as a default so that time change won't mess up the result of adding 24 hours to date

Properties

Name Type Description
value Real

Methods

Signature Return Type Description
day() Int
description() String
hashcode() Int
hour() Int
hour12() Int
is_am() Logical
is_pm() Logical
millisecond() Int
minute() Int
month() Int
month_name() String
operator+( other:TimeInterval ) Timestamp
operator-( other:TimeInterval ) Timestamp
operator-( other:Timestamp ) TimeInterval
operator<>( other:Timestamp ) Int64
operator==( other:Timestamp ) Logical
or_newer( other:Timestamp ) Timestamp
or_older( other:Timestamp ) Timestamp
print_to( buffer:PrintWriter )
second() Int
to<<Date>>() Date
to<<Object>>() Boxed<<Timestamp>>
to<<String>>() String
to<<Time>>() Time
to<<Variant>>() Variant
to<<String>>( &ymd, &hms, &ms, &format=24, &mdy ) String
type_info() TypeInfo
weekday() Int
weekday_name() String
year() Int
⚠️ **GitHub.com Fallback** ⚠️