net.liftweb.util.TimeHelpers

trait TimeHelpers

trait TimeHelpers

 extends ScalaObject


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


Companion: TimeHelpers

Source: TimeHelpers.scala(34)

Direct Known Subclasses

TimeHelpers, Helpers,

Nested Classes

CalendarExtension, DateExtension, TimeSpan, TimeSpanBuilder,

 Fields

TimeSpan.. object TimeSpan
The TimeSpan object provides class represents an amount of time [details]
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)


 extends ScalaObject
currentYear.. def currentYear
[details]
return
- the current year
Int
dateFormatter.. def dateFormatter
[details]
return
- a standard format for the date yyyy/MM/dd
SimpleDateFormat
dayNow.. def dayNow
[details]
deprecated
- use today instead
return
- the current Day as a Date object
Date
daysSinceEpoch.. def daysSinceEpoch
[details]
return
- the number of days since epoch
Long
formattedDateNow.. def formattedDateNow
[details]
return
- today's date formatted as yyyy/MM/dd
String
formattedTimeNow.. def formattedTimeNow
[details]
return
- now's time formatted as HH:mm zzz
String
hourFormat.. val hourFormat
[details]
return
- a standard format HH:mm:ss
SimpleDateFormat
internetDateFormatter.. def internetDateFormatter
[details]
return
- a formatter for internet dates including: the day of week, the month, day of month, time and time zone
SimpleDateFormat
millis.. def millis
[details]
return
- the current number of millis: System.currentTimeMillis
Long
now.. def now
[details]
return
- the date object for now
Date
nowAsInternetDate.. def nowAsInternetDate
[details]
return
- the current time as an internet date
String
timeFormatter.. def timeFormatter
[details]
return
- a format for the time which includes the TimeZone: HH:mm zzz
SimpleDateFormat
timeNow.. def timeNow
[details]
deprecated
- use now instead
return
- the current time as a Date object
Date
today.. def today
[details]
return
- the Calendar object for today (the TimeZone is the local TimeZone). Its time is 00:00:00.000
Calendar
utc.. val utc
The UTC TimeZone
TimeZone

 Methods

!=.. final def !=(arg0 : Any) Boolean Any
!=.. final def !=(arg0 : Object) Boolean AnyRef
==.. final def ==(arg0 : Object) Boolean AnyRef
==.. final def ==(arg0 : Any) Boolean Any
asInstanceOf.. final def asInstanceOf[T0] T0 Any
boxParseInternetDate.. def boxParseInternetDate(dateString : String)
[details]
return
- a date from a string using the internet format. Return the Epoch date if the parse is unsuccesfull
Box[Date]
calcTime.. def calcTime[T](f : => T)
[details]
return
- the time taken to evaluate f in millis and the result
(Long, T)
clone.. protected def clone Object AnyRef
day.. def day(in : Date)
[details]
return
- the day of month corresponding to the input date (1 based)
Int
days.. def days(in : Long)
[details]
return
- the number of millis corresponding to 'in' days
Long
eq.. final def eq(arg0 : Object) Boolean AnyRef
equals.. def equals(arg0 : Any) Boolean AnyRef
finalize.. protected def finalize Unit AnyRef
getClass.. final def getClass Class[Any] AnyRef
hashCode.. def hashCode Int AnyRef
hourFormat.. def hourFormat(in : Date)
[details]
return
- the formatted time for a given Date
String
hours.. def hours(in : Long)
[details]
return
- the number of millis corresponding to 'in' hours
Long
intToTimeSpan.. implicit def intToTimeSpan(in : Int)
transforms an int to a TimeSpan object [details]
Usage: 3000 returns a TimeSpan of 3000L millis
TimeSpan
intToTimeSpanBuilder.. implicit def intToTimeSpanBuilder(in : Int)
transforms an int to a TimeSpanBuilder object [details]
Usage: 3.seconds returns a TimeSpan of 3000L millis
TimeSpanBuilder
isInstanceOf.. final def isInstanceOf[T0] Boolean Any
logTime.. def logTime[T](msg : String)(f : => T)
Log a message with the time taken in millis to do something and retrun the result [details]
return
- the result
T
longToTimeSpan.. implicit def longToTimeSpan(in : Long)
transforms a long to a TimeSpan object [details]
Usage: 3000L returns a TimeSpan of 3000L millis
TimeSpan
longToTimeSpanBuilder.. implicit def longToTimeSpanBuilder(in : Long)
transforms a long to a TimeSpanBuilder object [details]
Usage: 3L.seconds returns a TimeSpan of 3000L millis
TimeSpanBuilder
millisToDays.. def millisToDays(millis : Long)
[details]
return
- the number of days since epoch converted from millis
Long
minutes.. def minutes(in : Long)
[details]
return
- the number of millis corresponding to 'in' minutes
Long
month.. def month(in : Date)
[details]
return
- the month corresponding to today (0 based, relative to UTC)
Int
ne.. final def ne(arg0 : Object) Boolean AnyRef
notify.. final def notify Unit AnyRef
notifyAll.. final def notifyAll Unit AnyRef
parseInternetDate.. def parseInternetDate(dateString : String)
[details]
return
- a date from a string using the internet format. Return the Epoch date if the parse is unsuccesfull
Date
seconds.. def seconds(in : Long)
[details]
return
- the number of millis corresponding to 'in' seconds
Long
synchronized.. final def synchronized[T0](arg0 : T0) T0 AnyRef
time.. def time(when : Long)
alias for new Date(millis)
Date
toCalendarExtension.. implicit def toCalendarExtension(c : Calendar)
implicit def used to add the setXXX methods to the Calendar class
CalendarExtension
toDate.. def toDate(in : Any)
[details]
return
- a Full(date) or a failure if the input couldn't be translated to date (or Empty if the input is null)
Box[Date]
toDateExtension.. implicit def toDateExtension(d : Date)
implicit def used to add the noTime method to the Date class
DateExtension
toInternetDate.. def toInternetDate(in : Date)
[details]
return
- a date formatted with the internet format
String
toInternetDate.. def toInternetDate(in : Long)
[details]
return
- a date formatted with the internet format (from a number of millis)
String
toString.. def toString String AnyRef
wait.. final def wait(arg0 : Long) Unit AnyRef
wait.. final def wait Unit AnyRef
wait.. final def wait(arg0 : Long, arg1 : Int) Unit AnyRef
weeks.. def weeks(in : Long)
[details]
return
- the number of millis corresponding to 'in' weeks
Long
year.. def year(in : Date)
[details]
return
- the year corresponding to today (relative to UTC)
Int
Copyright (c) 2006-2010 WorldWide Conferencing, LLC. All Rights Reserved.