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
- Alphabetic
- By Inheritance
- TimeHelpers
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Type Members
- class CalendarExtension extends AnyRef
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
- class DateExtension extends AnyRef
This class adds a noTime method the Date class, in order to get at Date object starting at 00:00
- implicit class DateTimeExtension extends AnyRef
- implicit class PeriodExtension[P] extends AnyRef
- class TimeSpan extends ConvertableToDate
The
TimeSpanclass represents a duration of time in milliseconds.The
TimeSpanclass represents a duration of time in milliseconds. In this way, it is similar to thescala.concurrent.Durationclass. It is mostly used in Lift APIs in similar positions as the ScalaDurationclass (for example, in event scheduling).Unlike in the Lift 2.x series, building a
TimeSpanwith aLongwill not have different behavior depending on the value passed. Any passedLongwill be used as a duration.Prior to Lift 3.0,
TimeSpanwas an amalgam of duration and jodaDateTime, 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 intoDateTimesemantics 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
TimeSpanAPI, 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.
- case class TimeSpanBuilder(len: Long) extends Product with Serializable
class building TimeSpans given an amount (len) and a method specify the time unit
Value Members
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##: Int
- Definition Classes
- AnyRef → Any
- final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- def boxParseInternetDate(dateString: String): Box[Date]
- returns
a Box[date] from a string using the internet format.
- def calcTime[T](f: => T): (Long, T)
- returns
the time taken to evaluate f in millis and the result
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @native()
- def currentYear: Int
- returns
the current year
- def dateFormatter: SimpleDateFormat
- returns
a standard format for the date yyyy/MM/dd
- def day(in: Date): Int
- returns
the day of month corresponding to the input date (1 based)
- def days(in: Long): Long
- returns
the number of millis corresponding to 'in' days
- def daysSinceEpoch: Long
- returns
the number of days since epoch
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef → Any
- def finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable])
- def formattedDateNow: String
- returns
today's date formatted as yyyy/MM/dd
- def formattedTimeNow: String
- returns
now's time formatted as HH:mm zzz
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- def hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- def hourFormat(in: Date): String
- returns
the formatted time for a given Date
- def hourFormat: SimpleDateFormat
- returns
a standard format HH:mm:ss
- def hours(in: Long): Long
- returns
the number of millis corresponding to 'in' hours
- implicit def intToTimeSpanBuilder(in: Int): (TimeHelpers.this)#TimeSpanBuilder
transforms an int to a TimeSpanBuilder object.
transforms an int to a TimeSpanBuilder object. Usage: 3.seconds returns a TimeSpan of 3000L millis
- def internetDateFormatter: SimpleDateFormat
- returns
a formatter for internet dates (RFC822/1123) including: the day of week, the month, day of month, time and time zone
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- def logTime[T](f: => (String, T)): T
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
- def logTime[T](msg: String)(f: => T): T
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
- implicit def longToTimeSpanBuilder(in: Long): (TimeHelpers.this)#TimeSpanBuilder
transforms a long to a TimeSpanBuilder object.
transforms a long to a TimeSpanBuilder object. Usage: 3L.seconds returns a TimeSpan of 3000L millis
- def millis: Long
- returns
the current number of millis: System.currentTimeMillis
- def millisToDays(millis: Long): Long
- returns
the number of days since epoch converted from millis
- def minutes(in: Long): Long
- returns
the number of millis corresponding to 'in' minutes
- def month(in: Date): Int
- returns
the month corresponding to today (0 based, relative to UTC)
- def nano: Long
- returns
the current System.nanoTime()
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- def now: Date
- returns
the date object for now
- def nowAsInternetDate: String
- returns
the current time as an internet date
- def parseInternetDate(dateString: String): Date
- returns
a date from a string using the internet format. Return the Epoch date if the parse is unsuccesful
- def seconds(in: Long): Long
- returns
the number of millis corresponding to 'in' seconds
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- def time(when: Long): Date
alias for new Date(millis)
- def timeFormatter: SimpleDateFormat
- returns
a format for the time which includes the TimeZone: HH:mm zzz
- implicit def toCalendarExtension(c: Calendar): (TimeHelpers.this)#CalendarExtension
implicit def used to add the setXXX methods to the Calendar class
- def toDate(in: Any): Box[Date]
- returns
a Full(date) or a failure if the input couldn't be translated to date (or Empty if the input is null)
- implicit def toDateExtension(d: Date): (TimeHelpers.this)#DateExtension
implicit def used to add the noTime method to the Date class
- def toInternetDate(in: Long): String
- returns
a date formatted with the internet format (from a number of millis)
- def toInternetDate(in: Date): String
- returns
a date formatted with the internet format
- def toString(): String
- Definition Classes
- AnyRef → Any
- def today: Calendar
- returns
the Calendar object for today (the TimeZone is the local TimeZone). Its time is 00:00:00.000
- val utc: TimeZone
The UTC TimeZone
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException]) @native()
- def weeks(in: Long): Long
- returns
the number of millis corresponding to 'in' weeks
- def year(in: Date): Int
- returns
the year corresponding to today (relative to UTC)
- object TimeSpan
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)
Deprecated Value Members
- implicit def intToTimeSpan(in: Int): (TimeHelpers.this)#TimeSpan
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
- implicit def longToTimeSpan(in: Long): (TimeHelpers.this)#TimeSpan
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