Jump to content
Wiki Home
EPrints Home
Bazaar
Files
Main menu
Main menu
move to sidebar
hide
Navigation
Front Page
EPrints 3 Manual
EPrints Training Course
EPrints Glossary
Installing EPrints
How-to Configure EPrints
EPrints 3.2+ API
EPrints 3 Reference
EPrints Plugins
Wiki
All categories
Recent changes
Main Page
Help
EPrints Documentation
Search
Search
Appearance
Log in
Request account
Personal tools
Log in
Request account
Pages for logged out editors
learn more
Contributions
Talk
Editing
API:EPrints/Time
Page
Discussion
British English
Read
Edit
View history
Tools
Tools
move to sidebar
hide
Actions
Read
Edit
View history
General
What links here
Related changes
Special pages
Page information
Appearance
move to sidebar
hide
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
<!-- Pod2Wiki=_preamble_ This page has been automatically generated from the EPrints 3.2 source. Any wiki changes made between the 'Pod2Wiki=*' and 'Edit below this comment' comments will be lost. -->{{API}}{{Pod2Wiki}}{{API:Source|file=perl_lib/EPrints/Time.pm|package_name=EPrints::Time}}[[Category:API|TIME]][[Category:API:EPrints/Time|TIME]]<div><!-- Edit below this comment --> <!-- Pod2Wiki=_private_ --><!-- Pod2Wiki=head_name --> ==NAME== '''EPrints::Time''' - Time and Date-related functions <!-- Edit below this comment --> <!-- Pod2Wiki= --> <!-- Pod2Wiki=head_synopsis --> ==SYNOPSIS== <source lang="perl">($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</source> <!-- Edit below this comment --> <!-- Pod2Wiki= --> <!-- Pod2Wiki=head_description --> ==DESCRIPTION== This package contains functions related to time/date functionality. <!-- Edit below this comment --> <!-- Pod2Wiki= --> <!-- Pod2Wiki=head_formats_used_in_eprints --> ==FORMATS USED IN EPRINTS== <!-- Edit below this comment --> <!-- Pod2Wiki= --> <!-- Pod2Wiki=head_internal_format --> ===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. <!-- Edit below this comment --> <!-- Pod2Wiki= --> <!-- Pod2Wiki=head_iso_8601_style_date_times --> ===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. <!-- Edit below this comment --> <!-- Pod2Wiki= --> <!-- Pod2Wiki=head_epoch_time --> ===Epoch time=== Time zone: UTC Format: integer Time in seconds since system epoch. Used in the login tickets table and when performing date calculations. <!-- Edit below this comment --> <!-- Pod2Wiki= --> <!-- Pod2Wiki=head_methods --> ==METHODS== <!-- Edit below this comment --> <!-- Pod2Wiki= --> <!-- Pod2Wiki=head_parsing --> ===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. <!-- Edit below this comment --> <!-- Pod2Wiki= --> <!-- Pod2Wiki=head_formatting --> ===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 {{API:PodLink|file=perlfunc|package_name=perlfunc|section=localtime|text=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 {{API:PodLink|file=perlfunc|package_name=perlfunc|section=gmtime|text=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 {{API:PodLink|file=perlfunc|package_name=perlfunc|section=localtime|text=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. <!-- Edit below this comment --> <!-- Pod2Wiki= --> <!-- Pod2Wiki=head_phrases --> ===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. <!-- Edit below this comment --> <!-- Pod2Wiki= --> <!-- Pod2Wiki=head_rendering --> ===Rendering=== $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. Month names are taken from the current repository language. E.g. <pre> 5 June 2010 10:35:12 +02:00 12 December 1912 # no time 1954 # no month/day</pre> $xhtml = EPrints::Time::render_short_date( $repo, $value ) Render a shorter form of [[API:EPrints/Time#render_date|render_date]]. E.g. <pre> 05 Jun 2010 10:35:12 12 Dec 1912 # no time 1954 # no month/day</pre> <!-- Pod2Wiki=head_copyright --> ==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/. <!-- Edit below this comment --> <!-- Pod2Wiki= --> <!-- Pod2Wiki=_postamble_ --> <!-- Edit below this comment -->
Summary:
Please note that all contributions to EPrints Documentation may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
EPrints Documentation:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Templates used on this page:
Template:API
(
edit
)
Template:API:PodLink
(
edit
)
Template:API:Source
(
edit
)
Template:Pod2Wiki
(
edit
)
Template:RefLinks
(
edit
)