Difference between revisions of "API:EPrints/Time"

From EPrints Documentation
Jump to: navigation, search
 
Line 8: Line 8:
 
'''EPrints::Time''' - Time and Date-related functions  
 
'''EPrints::Time''' - Time and Date-related functions  
  
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 
<span style='display:none'>User Comments</span>
 
 
<!-- Edit below this comment -->
 
<!-- Edit below this comment -->
  
  
 
<!-- Pod2Wiki= -->
 
<!-- Pod2Wiki= -->
</div>
 
 
<!-- Pod2Wiki=head_synopsis -->
 
<!-- Pod2Wiki=head_synopsis -->
 
==SYNOPSIS==
 
==SYNOPSIS==
  ($year) = EPrints::Time::utc_datetime()
+
<source lang="perl">($year) = EPrints::Time::utc_datetime()
  # 2010
+
# 2010
 
+
 
  ($year,$month) = EPrints::Time::local_datetime()
+
($year,$month) = EPrints::Time::local_datetime()
  # 2010, 6
+
# 2010, 6
 
+
 
  EPrints::Time::iso_datetime();  
+
EPrints::Time::iso_datetime();  
  # 2008-05-15T14:40:24Z
+
# 2008-05-15T14:40:24Z
 
+
 
  EPrints::Time::iso_date()
+
EPrints::Time::iso_date()
  # 2010-06-23
+
# 2010-06-23
 
+
 
  EPrints::Time::month_label( $repo, 11 )  
+
EPrints::Time::month_label( $repo, 11 )  
  # returns "November"
+
# returns "November"
 
+
 
  EPrints::Time::short_month_label( $repo, 11 )  
+
EPrints::Time::short_month_label( $repo, 11 )  
  # returns "Nov"
+
# returns "Nov"
 
+
 
  EPrints::Time::render_date( $repo, "2001-01-12T00:00:00Z" )  
+
EPrints::Time::render_date( $repo, "2001-01-12T00:00:00Z" )  
  # returns XML containing 12 January 2001 00:00
+
# returns XML containing 12 January 2001 00:00
 
+
 
  EPrints::Time::render_short_date( $repo, "2001-01-12T00:00:00Z" )  
+
EPrints::Time::render_short_date( $repo, "2001-01-12T00:00:00Z" )  
  # returns XML containing 12 Jan 2001 00:00
+
# returns XML containing 12 Jan 2001 00:00</source>
 
+
 
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 
<span style='display:none'>User Comments</span>
 
 
<!-- Edit below this comment -->
 
<!-- Edit below this comment -->
  
  
 
<!-- Pod2Wiki= -->
 
<!-- Pod2Wiki= -->
</div>
 
 
<!-- Pod2Wiki=head_description -->
 
<!-- Pod2Wiki=head_description -->
 
==DESCRIPTION==
 
==DESCRIPTION==
 
This package contains functions related to time/date functionality.  
 
This package contains functions related to time/date functionality.  
  
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 
<span style='display:none'>User Comments</span>
 
 
<!-- Edit below this comment -->
 
<!-- Edit below this comment -->
  
  
 
<!-- Pod2Wiki= -->
 
<!-- Pod2Wiki= -->
</div>
 
 
<!-- Pod2Wiki=head_formats_used_in_eprints -->
 
<!-- Pod2Wiki=head_formats_used_in_eprints -->
 
==FORMATS USED IN EPRINTS==
 
==FORMATS USED IN EPRINTS==
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 
<span style='display:none'>User Comments</span>
 
 
<!-- Edit below this comment -->
 
<!-- Edit below this comment -->
  
  
 
<!-- Pod2Wiki= -->
 
<!-- Pod2Wiki= -->
</div>
 
 
<!-- Pod2Wiki=head_internal_format -->
 
<!-- Pod2Wiki=head_internal_format -->
 
===Internal format===
 
===Internal format===
Line 76: Line 64:
 
These are used in the database and when setting and getting values. They can contain any fractional part of a date time.
 
These are used in the database and when setting and getting values. They can contain any fractional part of a date time.
  
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 
<span style='display:none'>User Comments</span>
 
 
<!-- Edit below this comment -->
 
<!-- Edit below this comment -->
  
  
 
<!-- Pod2Wiki= -->
 
<!-- Pod2Wiki= -->
</div>
 
 
<!-- Pod2Wiki=head_iso_8601_style_date_times -->
 
<!-- Pod2Wiki=head_iso_8601_style_date_times -->
 
===ISO 8601-style date/times===
 
===ISO 8601-style date/times===
Line 91: Line 76:
 
These are primarily used in XML output where times that conform to the standard XSD date/time are required.
 
These are primarily used in XML output where times that conform to the standard XSD date/time are required.
  
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 
<span style='display:none'>User Comments</span>
 
 
<!-- Edit below this comment -->
 
<!-- Edit below this comment -->
  
  
 
<!-- Pod2Wiki= -->
 
<!-- Pod2Wiki= -->
</div>
 
 
<!-- Pod2Wiki=head_epoch_time -->
 
<!-- Pod2Wiki=head_epoch_time -->
 
===Epoch time===
 
===Epoch time===
Line 106: Line 88:
 
Time in seconds since system epoch. Used in the login tickets table and when performing date calculations.
 
Time in seconds since system epoch. Used in the login tickets table and when performing date calculations.
  
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 
<span style='display:none'>User Comments</span>
 
 
<!-- Edit below this comment -->
 
<!-- Edit below this comment -->
  
  
 
<!-- Pod2Wiki= -->
 
<!-- Pod2Wiki= -->
</div>
 
 
<!-- Pod2Wiki=head_methods -->
 
<!-- Pod2Wiki=head_methods -->
 
==METHODS==
 
==METHODS==
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 
<span style='display:none'>User Comments</span>
 
 
<!-- Edit below this comment -->
 
<!-- Edit below this comment -->
  
  
 
<!-- Pod2Wiki= -->
 
<!-- Pod2Wiki= -->
</div>
 
 
<!-- Pod2Wiki=head_parsing -->
 
<!-- Pod2Wiki=head_parsing -->
 
===Parsing===
 
===Parsing===
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 
<span style='display:none'>User Comments</span>
 
<!-- Edit below this comment -->
 
 
 
<!-- Pod2Wiki= -->
 
</div>
 
<!-- Pod2Wiki=item_split_value -->
 
====split_value====
 
 
 
  @t = split_value( $value )
 
  @t = split_value( $value )
 
Splits internal or ISO format $value into years, months, days, hours, minutes, seconds.
 
Splits internal or ISO format $value into years, months, days, hours, minutes, seconds.
 
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 
<span style='display:none'>User Comments</span>
 
<!-- Edit below this comment -->
 
 
 
<!-- Pod2Wiki= -->
 
</div>
 
<!-- Pod2Wiki=item_datetime_local -->
 
====datetime_local====
 
  
 
  $time = datetime_local( @t )
 
  $time = datetime_local( @t )
 
Returns local time @t as the number of seconds since epoch, where @t is years, months etc.
 
Returns local time @t as the number of seconds since epoch, where @t is years, months etc.
 
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 
<span style='display:none'>User Comments</span>
 
<!-- Edit below this comment -->
 
 
 
<!-- Pod2Wiki= -->
 
</div>
 
<!-- Pod2Wiki=item_datetime_utc -->
 
====datetime_utc====
 
  
 
  $time = datetime_utc( @t )
 
  $time = datetime_utc( @t )
 
Returns UTC time @t as the number of seconds since epoch, where @t is years, months etc.
 
Returns UTC time @t as the number of seconds since epoch, where @t is years, months etc.
  
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 
<span style='display:none'>User Comments</span>
 
 
<!-- Edit below this comment -->
 
<!-- Edit below this comment -->
  
  
 
<!-- Pod2Wiki= -->
 
<!-- Pod2Wiki= -->
</div>
 
 
<!-- Pod2Wiki=head_formatting -->
 
<!-- Pod2Wiki=head_formatting -->
 
===Formatting===
 
===Formatting===
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 
<span style='display:none'>User Comments</span>
 
<!-- Edit below this comment -->
 
 
 
<!-- Pod2Wiki= -->
 
</div>
 
<!-- Pod2Wiki=item_join_value -->
 
====join_value====
 
 
 
  $datetime = EPrints::Time::join_value( @t )
 
  $datetime = EPrints::Time::join_value( @t )
 
Return a time @t in internal format.
 
Return a time @t in internal format.
  
 
Returns undef if no parts are defined.
 
Returns undef if no parts are defined.
 
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 
<span style='display:none'>User Comments</span>
 
<!-- Edit below this comment -->
 
 
 
<!-- Pod2Wiki= -->
 
</div>
 
<!-- Pod2Wiki=item_local_datetime -->
 
====local_datetime====
 
  
 
  ($year,$mon,$day,$hour,$min,$sec) = EPrints::Time::local_datetime( [ $seconds ] )
 
  ($year,$mon,$day,$hour,$min,$sec) = EPrints::Time::local_datetime( [ $seconds ] )
Line 201: Line 124:
  
 
$seconds is seconds since epoch or now if not given.
 
$seconds is seconds since epoch or now if not given.
 
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 
<span style='display:none'>User Comments</span>
 
<!-- Edit below this comment -->
 
 
 
<!-- Pod2Wiki= -->
 
</div>
 
<!-- Pod2Wiki=item_utc_datetime -->
 
====utc_datetime====
 
  
 
  ($year,$mon,$day,$hour,$min,$sec) = EPrints::Time::utc_datetime( [ $seconds ] )
 
  ($year,$mon,$day,$hour,$min,$sec) = EPrints::Time::utc_datetime( [ $seconds ] )
Line 216: Line 129:
  
 
$seconds is seconds since epoch or now if not given.
 
$seconds is seconds since epoch or now if not given.
 
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 
<span style='display:none'>User Comments</span>
 
<!-- Edit below this comment -->
 
 
 
<!-- Pod2Wiki= -->
 
</div>
 
<!-- Pod2Wiki=item_iso_date -->
 
====iso_date====
 
  
 
  $date = EPrints::Time::iso_date( [ $seconds ] )
 
  $date = EPrints::Time::iso_date( [ $seconds ] )
Line 231: Line 134:
  
 
$seconds is seconds since epoch or now if not given.
 
$seconds is seconds since epoch or now if not given.
 
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 
<span style='display:none'>User Comments</span>
 
<!-- Edit below this comment -->
 
 
 
<!-- Pod2Wiki= -->
 
</div>
 
<!-- Pod2Wiki=item_iso_datetime -->
 
====iso_datetime====
 
  
 
  $datetime = EPrints::Time::iso_datetime( [ $seconds ] );
 
  $datetime = EPrints::Time::iso_datetime( [ $seconds ] );
Line 246: Line 139:
  
 
$seconds is seconds since epoch or now if not given.
 
$seconds is seconds since epoch or now if not given.
 
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 
<span style='display:none'>User Comments</span>
 
<!-- Edit below this comment -->
 
 
 
<!-- Pod2Wiki= -->
 
</div>
 
<!-- Pod2Wiki=item_rfc822_datetime -->
 
====rfc822_datetime====
 
  
 
  $datetime = EPrints::Time::rfc822_datetime( [ $seconds ] )
 
  $datetime = EPrints::Time::rfc822_datetime( [ $seconds ] )
Line 261: Line 144:
  
 
$seconds is seconds since epoch or now if not given.
 
$seconds is seconds since epoch or now if not given.
 
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 
<span style='display:none'>User Comments</span>
 
<!-- Edit below this comment -->
 
 
 
<!-- Pod2Wiki= -->
 
</div>
 
<!-- Pod2Wiki=item_human_time -->
 
====human_time====
 
  
 
  $timestamp = EPrints::Time::human_time( [$time] )
 
  $timestamp = EPrints::Time::human_time( [$time] )
 
Return a string describing the current local date and time in the current locale's format, see {{API:PodLink|file=perlfunc|package_name=perlfunc|section=localtime|text=perlfunc/localtime}}.
 
Return a string describing the current local date and time in the current locale's format, see {{API:PodLink|file=perlfunc|package_name=perlfunc|section=localtime|text=perlfunc/localtime}}.
 
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 
<span style='display:none'>User Comments</span>
 
<!-- Edit below this comment -->
 
 
 
<!-- Pod2Wiki= -->
 
</div>
 
<!-- Pod2Wiki=item_human_delay -->
 
====human_delay====
 
  
 
  $timestamp = EPrints::Time::human_delay( $hours );
 
  $timestamp = EPrints::Time::human_delay( $hours );
Line 290: Line 153:
 
$hours the number of hours representing the time you want to be human readable.
 
$hours the number of hours representing the time you want to be human readable.
  
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 
<span style='display:none'>User Comments</span>
 
 
<!-- Edit below this comment -->
 
<!-- Edit below this comment -->
  
  
 
<!-- Pod2Wiki= -->
 
<!-- Pod2Wiki= -->
</div>
 
 
<!-- Pod2Wiki=head_phrases -->
 
<!-- Pod2Wiki=head_phrases -->
 
===Phrases===
 
===Phrases===
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 
<span style='display:none'>User Comments</span>
 
<!-- Edit below this comment -->
 
 
 
<!-- Pod2Wiki= -->
 
</div>
 
<!-- Pod2Wiki=item_month_label -->
 
====month_label====
 
 
 
  $label = EPrints::Time::month_label( $repo, $monthid )
 
  $label = EPrints::Time::month_label( $repo, $monthid )
 
Return a UTF-8 string describing the month, in the current lanugage.
 
Return a UTF-8 string describing the month, in the current lanugage.
  
 
$monthid is an integer from 1 to 12.
 
$monthid is an integer from 1 to 12.
 
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 
<span style='display:none'>User Comments</span>
 
<!-- Edit below this comment -->
 
 
 
<!-- Pod2Wiki= -->
 
</div>
 
<!-- Pod2Wiki=item_short_month_label -->
 
====short_month_label====
 
  
 
  $label = EPrints::Time::short_month_label( $repo, $monthid )
 
  $label = EPrints::Time::short_month_label( $repo, $monthid )
Line 329: Line 169:
 
$monthid is an integer from 1 to 12.
 
$monthid is an integer from 1 to 12.
  
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 
<span style='display:none'>User Comments</span>
 
 
<!-- Edit below this comment -->
 
<!-- Edit below this comment -->
  
  
 
<!-- Pod2Wiki= -->
 
<!-- Pod2Wiki= -->
</div>
 
 
<!-- Pod2Wiki=head_rendering -->
 
<!-- Pod2Wiki=head_rendering -->
 
===Rendering===
 
===Rendering===
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 
<span style='display:none'>User Comments</span>
 
<!-- Edit below this comment -->
 
 
 
<!-- Pod2Wiki= -->
 
</div>
 
<!-- Pod2Wiki=item_render_date -->
 
====render_date====
 
 
 
  $xhtml = EPrints::Time::render_date( $repo, $value )
 
  $xhtml = EPrints::Time::render_date( $repo, $value )
 
Renders a [[API:EPrints/MetaField/Date|EPrints::MetaField::Date]] or [[API:EPrints/MetaField/Time|EPrints::MetaField::Time]] value in a human-friendly form in the current locale's time zone.
 
Renders a [[API:EPrints/MetaField/Date|EPrints::MetaField::Date]] or [[API:EPrints/MetaField/Time|EPrints::MetaField::Time]] value in a human-friendly form in the current locale's time zone.
Line 355: Line 182:
 
E.g.
 
E.g.
  
  5 June 2010 10:35:12 +02:00
+
<pre>  5 June 2010 10:35:12 +02:00
 
   12 December 1912 # no time
 
   12 December 1912 # no time
   1954 # no month/day
+
   1954 # no month/day</pre>
 
 
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 
<span style='display:none'>User Comments</span>
 
<!-- Edit below this comment -->
 
 
 
 
 
<!-- Pod2Wiki= -->
 
</div>
 
<!-- Pod2Wiki=item_render_short_date -->
 
====render_short_date====
 
  
 
  $xhtml = EPrints::Time::render_short_date( $repo, $value )
 
  $xhtml = EPrints::Time::render_short_date( $repo, $value )
Line 374: Line 191:
 
E.g.
 
E.g.
  
  05 Jun 2010 10:35:12
+
<pre>  05 Jun 2010 10:35:12
 
   12 Dec 1912 # no time
 
   12 Dec 1912 # no time
   1954 # no month/day
+
   1954 # no month/day</pre>
 
 
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 
<span style='display:none'>User Comments</span>
 
<!-- Edit below this comment -->
 
 
 
  
<!-- Pod2Wiki= -->
 
</div>
 
 
<!-- Pod2Wiki=head_copyright -->
 
<!-- Pod2Wiki=head_copyright -->
 
==COPYRIGHT==
 
==COPYRIGHT==
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
+
: Copyright 2000-2011 University of Southampton.
<span style='display:none'>User Comments</span>
+
 
 +
: This file is part of EPrints http://www.eprints.org/.
 +
 
 +
: EPrints is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
 +
 
 +
: EPrints is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more details.
 +
 
 +
: You should have received a copy of the GNU Lesser General Public License along with EPrints.  If not, see http://www.gnu.org/licenses/.
 +
 
 
<!-- Edit below this comment -->
 
<!-- Edit below this comment -->
  
  
 
<!-- Pod2Wiki= -->
 
<!-- Pod2Wiki= -->
</div>
+
<!-- Pod2Wiki=_postamble_ -->
<!-- Pod2Wiki=_postamble_ --><!-- Edit below this comment -->
+
<!-- Edit below this comment -->

Latest revision as of 09:56, 22 January 2013

EPrints 3 Reference: Directory Structure - Metadata Fields - Repository Configuration - XML Config Files - XML Export Format - EPrints data structure - Core API - Data Objects


API: Core API

Latest Source Code (3.4, 3.3) | Revision Log | Before editing this page please read Pod2Wiki


NAME

EPrints::Time - Time and Date-related functions


SYNOPSIS

($year) = EPrints::Time::utc_datetime()
# 2010

($year,$month) = EPrints::Time::local_datetime()
# 2010, 6

EPrints::Time::iso_datetime(); 
# 2008-05-15T14:40:24Z

EPrints::Time::iso_date()
# 2010-06-23

EPrints::Time::month_label( $repo, 11 ) 
# returns "November"

EPrints::Time::short_month_label( $repo, 11 ) 
# returns "Nov"

EPrints::Time::render_date( $repo, "2001-01-12T00:00:00Z" ) 
# returns XML containing 12 January 2001 00:00

EPrints::Time::render_short_date( $repo, "2001-01-12T00:00:00Z" ) 
# returns XML containing 12 Jan 2001 00:00


DESCRIPTION

This package contains functions related to time/date functionality.


FORMATS USED IN EPRINTS

Internal format

Time zone: UTC (database), server local time (embargoes)

Format: YYYY or YYYY-MM or YYYY-MM-DD or "YYYY-MM-DD hh" or "YYYY-MM-DD hh:mm" or "YYYY-MM-DD hh:mm:ss"

These are used in the database and when setting and getting values. They can contain any fractional part of a date time.


ISO 8601-style date/times

Time zone: UTC

Format: YYYY-MM-DD or YYYY-MM-DDThh:mm:ssZ

These are primarily used in XML output where times that conform to the standard XSD date/time are required.


Epoch time

Time zone: UTC

Format: integer

Time in seconds since system epoch. Used in the login tickets table and when performing date calculations.


METHODS

Parsing

@t = split_value( $value )

Splits internal or ISO format $value into years, months, days, hours, minutes, seconds.

$time = datetime_local( @t )

Returns local time @t as the number of seconds since epoch, where @t is years, months etc.

$time = datetime_utc( @t )

Returns UTC time @t as the number of seconds since epoch, where @t is years, months etc.


Formatting

$datetime = EPrints::Time::join_value( @t )

Return a time @t in internal format.

Returns undef if no parts are defined.

($year,$mon,$day,$hour,$min,$sec) = EPrints::Time::local_datetime( [ $seconds ] )

Returns the local date-time as an array, see perlfunc/localtime.

$seconds is seconds since epoch or now if not given.

($year,$mon,$day,$hour,$min,$sec) = EPrints::Time::utc_datetime( [ $seconds ] )

Returns the UTC date-time as an array, see perlfunc/gmtime.

$seconds is seconds since epoch or now if not given.

$date = EPrints::Time::iso_date( [ $seconds ] )

Return a UTC date of the form YYYY-MM-DD.

$seconds is seconds since epoch or now if not given.

$datetime = EPrints::Time::iso_datetime( [ $seconds ] );

Return a UTC date-time of the form YYYY-MM-DDTHH:MM:SSZ

$seconds is seconds since epoch or now if not given.

$datetime = EPrints::Time::rfc822_datetime( [ $seconds ] )

Return the local date-time in RFC 822 format (used by e.g. RSS).

$seconds is seconds since epoch or now if not given.

$timestamp = EPrints::Time::human_time( [$time] )

Return a string describing the current local date and time in the current locale's format, see perlfunc/localtime.

$timestamp = EPrints::Time::human_delay( $hours );

Returns a human readable amount of time.

$hours the number of hours representing the time you want to be human readable.


Phrases

$label = EPrints::Time::month_label( $repo, $monthid )

Return a UTF-8 string describing the month, in the current lanugage.

$monthid is an integer from 1 to 12.

$label = EPrints::Time::short_month_label( $repo, $monthid )

Return a UTF-8 string of a short representation in month, in the current lanugage.

$monthid is an integer from 1 to 12.


Rendering

$xhtml = EPrints::Time::render_date( $repo, $value )

Renders a EPrints::MetaField::Date or EPrints::MetaField::Time value in a human-friendly form in the current locale's time zone.

Month names are taken from the current repository language.

E.g.

  5 June 2010 10:35:12 +02:00
  12 December 1912 # no time
  1954 # no month/day
$xhtml = EPrints::Time::render_short_date( $repo, $value )

Render a shorter form of render_date.

E.g.

  05 Jun 2010 10:35:12
  12 Dec 1912 # no time
  1954 # no month/day

COPYRIGHT

Copyright 2000-2011 University of Southampton.
This file is part of EPrints http://www.eprints.org/.
EPrints is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
EPrints is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License along with EPrints. If not, see http://www.gnu.org/licenses/.