Trait/Object

net.liftweb.util

TimeHelpers

Related Docs: object TimeHelpers | package util

Permalink

trait TimeHelpers extends AnyRef

The TimeHelpers trait provide functions to create TimeSpans (an object representing duration in milliseconds), to manage date formats or general utility functions (get the date for today, get year/month/day number,...)

Self Type
TimeHelpers with ControlHelpers
Linear Supertypes
Known Subclasses
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. TimeHelpers
  2. AnyRef
  3. Any
  1. Hide All
  2. Show all
Visibility
  1. Public
  2. All

Type Members

  1. class CalendarExtension extends AnyRef

    Permalink

    This class adds the setXXX methods to the Calendar class.

    This class adds the setXXX methods to the Calendar class. Each setter returns the updated Calendar

  2. class DateExtension extends AnyRef

    Permalink

    This class adds a noTime method the Date class, in order to get at Date object starting at 00:00

  3. implicit class DateTimeExtension extends AnyRef

    Permalink
  4. implicit class PeriodExtension[P] extends AnyRef

    Permalink
  5. class TimeSpan extends ConvertableToDate

    Permalink

    The TimeSpan class represents a duration of time in milliseconds.

    The TimeSpan class represents a duration of time in milliseconds. In this way, it is similar to the scala.concurrent.Duration class. It is mostly used in Lift APIs in similar positions as the Scala Duration class (for example, in event scheduling).

    Unlike in the Lift 2.x series, building a TimeSpan with a Long will not have different behavior depending on the value passed. Any passed Long will be used as a duration.

    Prior to Lift 3.0, TimeSpan was an amalgam of duration and joda DateTime, and allowed conversions between the two. As a result, operational semantics were poorly defined and it was easy to call a method that seemed like it should have simple duration semantics but run into DateTime semantics that made things more complicated instead.

    Lift 3.0 mostly maintains API compatibility with the Lift 2.x series, but introduces a series of deprecations to indicate places where dangerous and potentially unclear behavior may occur. Lift 3.1 will maintain API compatibility with all non-deprecated parts of the TimeSpan API, but will remove the deprecated aspects.

    For deprecated years and month builders it handle an operations on duration field values. Then it could be used only in to-period implicit conversion.

  6. case class TimeSpanBuilder(len: Long) extends Product with Serializable

    Permalink

    class building TimeSpans given an amount (len) and a method specify the time unit

Value Members

  1. final def !=(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  4. object TimeSpan

    Permalink

    The TimeSpan object provides class represents an amount of time.

    The TimeSpan object provides class represents an amount of time. It can be translated to a date with the date method. In that case, the number of millis seconds will be used to create a Date object starting from the Epoch time (see the documentation for java.util.Date)

  5. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  6. def boxParseInternetDate(dateString: String): Box[Date]

    Permalink

    returns

    a Box[date] from a string using the internet format.

  7. def calcTime[T](f: ⇒ T): (Long, T)

    Permalink

    returns

    the time taken to evaluate f in millis and the result

  8. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  9. def currentYear: Int

    Permalink

    returns

    the current year

  10. def dateFormatter: SimpleDateFormat

    Permalink

    returns

    a standard format for the date yyyy/MM/dd

  11. def day(in: Date): Int

    Permalink

    returns

    the day of month corresponding to the input date (1 based)

  12. def days(in: Long): Long

    Permalink

    returns

    the number of millis corresponding to 'in' days

  13. def daysSinceEpoch: Long

    Permalink

    returns

    the number of days since epoch

  14. final def eq(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  15. def equals(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  16. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  17. def formattedDateNow: String

    Permalink

    returns

    today's date formatted as yyyy/MM/dd

  18. def formattedTimeNow: String

    Permalink

    returns

    now's time formatted as HH:mm zzz

  19. final def getClass(): Class[_]

    Permalink
    Definition Classes
    AnyRef → Any
  20. def hashCode(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  21. def hourFormat(in: Date): String

    Permalink

    returns

    the formatted time for a given Date

  22. def hourFormat: SimpleDateFormat

    Permalink

    returns

    a standard format HH:mm:ss

  23. def hours(in: Long): Long

    Permalink

    returns

    the number of millis corresponding to 'in' hours

  24. implicit def intToTimeSpanBuilder(in: Int): (TimeHelpers.this)#TimeSpanBuilder

    Permalink

    transforms an int to a TimeSpanBuilder object.

    transforms an int to a TimeSpanBuilder object. Usage: 3.seconds returns a TimeSpan of 3000L millis

  25. def internetDateFormatter: SimpleDateFormat

    Permalink

    returns

    a formatter for internet dates (RFC822/1123) including: the day of week, the month, day of month, time and time zone

  26. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  27. def logTime[T](f: ⇒ (String, T)): T

    Permalink

    Call f and log the string returned together with the time taken in millis.

    Call f and log the string returned together with the time taken in millis.

    returns

    the second result from f

  28. def logTime[T](msg: String)(f: ⇒ T): T

    Permalink

    Log a message with the time taken in millis to do something and return the result

    Log a message with the time taken in millis to do something and return the result

    returns

    the result

  29. implicit def longToTimeSpanBuilder(in: Long): (TimeHelpers.this)#TimeSpanBuilder

    Permalink

    transforms a long to a TimeSpanBuilder object.

    transforms a long to a TimeSpanBuilder object. Usage: 3L.seconds returns a TimeSpan of 3000L millis

  30. def millis: Long

    Permalink

    returns

    the current number of millis: System.currentTimeMillis

  31. def millisToDays(millis: Long): Long

    Permalink

    returns

    the number of days since epoch converted from millis

  32. def minutes(in: Long): Long

    Permalink

    returns

    the number of millis corresponding to 'in' minutes

  33. def month(in: Date): Int

    Permalink

    returns

    the month corresponding to today (0 based, relative to UTC)

  34. def nano: Long

    Permalink

    returns

    the current System.nanoTime()

  35. final def ne(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  36. final def notify(): Unit

    Permalink
    Definition Classes
    AnyRef
  37. final def notifyAll(): Unit

    Permalink
    Definition Classes
    AnyRef
  38. def now: Date

    Permalink

    returns

    the date object for now

  39. def nowAsInternetDate: String

    Permalink

    returns

    the current time as an internet date

  40. def parseInternetDate(dateString: String): Date

    Permalink

    returns

    a date from a string using the internet format. Return the Epoch date if the parse is unsuccesful

  41. def seconds(in: Long): Long

    Permalink

    returns

    the number of millis corresponding to 'in' seconds

  42. final def synchronized[T0](arg0: ⇒ T0): T0

    Permalink
    Definition Classes
    AnyRef
  43. def time(when: Long): Date

    Permalink

    alias for new Date(millis)

  44. def timeFormatter: SimpleDateFormat

    Permalink

    returns

    a format for the time which includes the TimeZone: HH:mm zzz

  45. implicit def toCalendarExtension(c: Calendar): (TimeHelpers.this)#CalendarExtension

    Permalink

    implicit def used to add the setXXX methods to the Calendar class

  46. def toDate(in: Any): Box[Date]

    Permalink

    returns

    a Full(date) or a failure if the input couldn't be translated to date (or Empty if the input is null)

  47. implicit def toDateExtension(d: Date): (TimeHelpers.this)#DateExtension

    Permalink

    implicit def used to add the noTime method to the Date class

  48. def toInternetDate(in: Long): String

    Permalink

    returns

    a date formatted with the internet format (from a number of millis)

  49. def toInternetDate(in: Date): String

    Permalink

    returns

    a date formatted with the internet format

  50. def toString(): String

    Permalink
    Definition Classes
    AnyRef → Any
  51. def today: Calendar

    Permalink

    returns

    the Calendar object for today (the TimeZone is the local TimeZone). Its time is 00:00:00.000

  52. val utc: TimeZone

    Permalink

    The UTC TimeZone

  53. final def wait(): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  54. final def wait(arg0: Long, arg1: Int): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  55. final def wait(arg0: Long): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  56. def weeks(in: Long): Long

    Permalink

    returns

    the number of millis corresponding to 'in' weeks

  57. def year(in: Date): Int

    Permalink

    returns

    the year corresponding to today (relative to UTC)

Deprecated Value Members

  1. implicit def intToTimeSpan(in: Int): (TimeHelpers.this)#TimeSpan

    Permalink

    transforms an int to a TimeSpan object.

    transforms an int to a TimeSpan object. Usage: 3000 returns a TimeSpan of 3000L millis

    Annotations
    @deprecated
    Deprecated

    (Since version 3.0.0) Int to TimeSpan conversion will be removed for possibility of ambiguous behaviours, use TimeSpan(in) instead if you are using in.millis

  2. implicit def longToTimeSpan(in: Long): (TimeHelpers.this)#TimeSpan

    Permalink

    transforms a long to a TimeSpan object.

    transforms a long to a TimeSpan object. Usage: 3000L returns a TimeSpan of 3000L millis

    Annotations
    @deprecated
    Deprecated

    (Since version 3.0.0) Long to TimeSpan conversion will be removed for possibility of ambiguous behaviours, use TimeSpan(in) instead if you are using in.millis

Inherited from AnyRef

Inherited from Any

Ungrouped