org.apache.directory.shared.ldap.util
Class DateUtils
java.lang.Object
org.apache.directory.shared.ldap.util.DateUtils
public class DateUtils
- extends java.lang.Object
Gets the generalized time using the "Z" form of the g-time-zone.
- Version:
- $Rev: 434411 $
- Author:
- Apache Directory Project
Method Summary |
static java.util.Date |
getDate(java.lang.String zuluTime)
|
static int |
getDay(java.lang.String zuluTime)
|
static java.lang.String |
getGeneralizedTime()
Gets the generalized time using the "Z" form of the g-time-zone described
by [
SYNTAXES] section 3.3.13, included below: |
static int |
getHour(java.lang.String zuluTime)
|
static int |
getMinutes(java.lang.String zuluTime)
|
static int |
getMonth(java.lang.String zuluTime)
|
static int |
getSeconds(java.lang.String zuluTime)
|
static int |
getYear(java.lang.String zuluTime)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
DateUtils
public DateUtils()
getDate
public static java.util.Date getDate(java.lang.String zuluTime)
getYear
public static int getYear(java.lang.String zuluTime)
getMonth
public static int getMonth(java.lang.String zuluTime)
getDay
public static int getDay(java.lang.String zuluTime)
getHour
public static int getHour(java.lang.String zuluTime)
getMinutes
public static int getMinutes(java.lang.String zuluTime)
getSeconds
public static int getSeconds(java.lang.String zuluTime)
getGeneralizedTime
public static java.lang.String getGeneralizedTime()
- Gets the generalized time using the "Z" form of the g-time-zone described
by [
SYNTAXES] section 3.3.13, included below:
3.3.13. Generalized Time
A value of the Generalized Time syntax is a character string
representing a date and time. The LDAP-specific encoding of a value
of this syntax is a restriction of the format defined in [ISO8601],
and is described by the following ABNF:
century = 2(%x30-39) ; "00" to "99"
year = 2(%x30-39) ; "00" to "99"
month = ( %x30 %x31-39 ) ; "01" (January) to "09"
/ ( %x31 %x30-32 ) ; "10" to "12"
day = ( %x30 %x31-39 ) ; "01" to "09"
/ ( %x31-32 %x30-39 ) ; "10" to "29"
/ ( %x33 %x30-31 ) ; "30" to "31"
hour = ( %x30-31 %x30-39 ) / ( %x32 %x30-33 ) ; "00" to "23"
minute = %x30-35 %x30-39 ; "00" to "59"
second = ( %x30-35 %x30-39 ) ; "00" to "59"
/ ( %x36 %x30 ) ; "60" (a leap second)
GeneralizedTime = century year month day hour
[ minute [ second ] ] [ fraction ]
g-time-zone
fraction = ( DOT / COMMA ) 1*(%x30-39)
g-time-zone = %x5A ; "Z"
/ g-differential
g-differential = ( MINUS / PLUS ) hour [ minute ]
MINUS = %x2D ; minus sign ("-")
The <DOT>, <COMMA> and <PLUS> rules are defined in [MODELS].
The time value represents coordinated universal time (equivalent to
Greenwich Mean Time) if the "Z" form of <g-time-zone> is used,
otherwise the value represents a local time in the time zone
indicated by <g-differential>. In the latter case, coordinated
universal time can be calculated by subtracting the differential from
the local time. The "Z" form of <g-time-zone> SHOULD be used in
preference to <g-differential>.
Examples:
199412161032Z
199412160532-0500
Both example values represent the same coordinated universal time:
10:32 AM, December 16, 1994.
The LDAP definition for the Generalized Time syntax is:
( 1.3.6.1.4.1.1466.115.121.1.24 DESC 'Generalized Time' )
This syntax corresponds to the GeneralizedTime ASN.1 type from
[ASN.1], with the constraint that local time without a differential
SHALL NOT be used.
Gets the generalized time right now.
- Returns:
- the generalizedTime right now
Copyright © 2004-2011. All Rights Reserved.