Difference between revisions of "Time field"

From EPrints Documentation
Jump to: navigation, search
(Additional Properties)
 
(6 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{{reference}}
 
 
{{fieldtypes}}
 
{{fieldtypes}}
  
== Inherritance ==
 
 
* [[Metadata]]
 
** [[Date field]]
 
*** [[Time field]]
 
  
 
== Description ==
 
== Description ==
 
 
This field is very similar to [[date field]] but allows the inclusion of hours, mintues and seconds. It is used for the various timestamps associated with an eprint record.
 
This field is very similar to [[date field]] but allows the inclusion of hours, mintues and seconds. It is used for the various timestamps associated with an eprint record.
  
 
Times are always stored in UTC and rendered in the local timezone.
 
Times are always stored in UTC and rendered in the local timezone.
  
In version 3.0 times must be input and searched in UTC. This is undesirable, but must systems do not require searching down to the hour. This may be addressed in a later version. (developers note: if this is an issue for you, drop us a line).
+
== Inheritance ==
 +
* [[Metadata]]
 +
** [[Date field]]
 +
*** [[Time field]]
  
== Properties ==
+
== Additional Properties ==
 
+
Same as [[Date field#Additional_Properties|Date fields]] except for
As for [[date field]]s with the following differences...
 
  
 
{| border="1" cellpadding="3" cellspacing="0"
 
{| border="1" cellpadding="3" cellspacing="0"
| name || default || description
+
! Name !! Default Value !! Required? !! Description !! Notes
 
|-
 
|-
| '''min_resolution''' || second || One of second/minute/hour/day/month/year. Indicates the smallest unit of measure that must be entered to make a value valid. Eg. if "day" so long as there's a year+month+day the hours,seconds and minutes are optional.
+
| '''min_resolution''' || <tt>second</tt> || NO || Indicates the smallest unit of measure that must be entered to make a value valid. Can be <tt>second</tt>, <tt>minute</tt>, <tt>hour</tt>, <tt>day</tt> <tt>month</tt> or <tt>year</tt>. || Different from [[Date field]] default (<tt>day</tt>). E.g. <tt>day</tt> indicates <tt>year</tt>, <tt>month</tt> and <tt>day</tt> are required and <tt>hour</tt>, <tt>minute</tt> and <tt>second</tt> are optional.
 
|-
 
|-
| '''render_res''' || day || One of second/minute/hour/day/month/year. If set to "year" then the dates 1998-10-01, 1998-10 and 1998 would all be rendered as "1998". This is not too useful in configuring the field, but can be set as a print option inside citation files. Although it can be handy to store the time right down to the second, you often will just want to render the hours and minutes for day to day use.
+
| '''render_res''' || <tt>second</tt> || NO || Indicates the smallest unit of time that should be rendered for the value. an be <tt>second</tt>, <tt>minute</tt>, <tt>hour</tt>, <tt>day</tt> <tt>month</tt> or <tt>year</tt>. || Different from [[Date field]] default (<tt>day</tt>). This is not too useful in configuring the field, but can be set as a print option inside citation files. Although it can be handy to store the time right down to the second, you often will just want to render the hours and minutes for day to day use.
 
|-
 
|-
| '''render_style''' || long || One of short/long.  
+
| '''render_style''' || <tt>long</tt> || NO || Whether to render time in <tt>long</tt> or <tt>short</tt> format. || Same default value as [[Date field]]. However, if <tt>long</tt> then renders like <tt>8 September 1998 23:12:11 +01:00</tt>. If <tt>short</tt> then renders like <tt>08 Sep 1998 23:12:11</tt>.
 
 
If "long" then you'll see "8 September 1998 23:12:11 +01:00".  
 
 
 
If "short" then value is rendered as "08 Sep 1998 23:12:11".
 
 
|}
 
|}
  
 
== Required Phrases ==
 
== Required Phrases ==
 
+
No additional phrases beyond those required for [[Date field#Required_Phrases|Date fields]].
None.
 
  
 
== Database ==
 
== Database ==
 
+
  fieldname_year SMALLINT(6)
  fieldname_year SMALLINT, fieldname_month SMALLINT, fieldname_day SMALLINT,
+
fieldname_month SMALLINT(6)
  fieldname_hour SMALLINT, fieldname_minute SMALLINT, fieldname_second SMALLINT
+
fieldname_day SMALLINT(6)
 +
fieldname_hour SMALLINT(6)
 +
fieldname_minute SMALLINT(6)
 +
fieldname_second SMALLINT(6)
  
 
== API ==
 
== API ==
 +
See [[API:EPrints/MetaField/Time|API page]].
  
Similar to [[date field]] but of the format "YYYY-MM-DD HH:MM:SS". Parts may be ommited, eg. YYYY-MM-DD HH:MM".
+
== Examples ==
 
+
Most basic example.
== Search ==
+
{
 
+
    name => 'timestamp',
Exactly the same as [[date field]]s. In 3.0 there is no way to make finer grained searches than by day.
+
    type => 'time',
 +
}
 +
Only render valyes down to the nearest minute.
 +
{
 +
    name => 'datestamp',
 +
    type => 'time',
 +
    render_res => 'minute',
 +
}
 +
Render date and time in short form.
 +
{
 +
    name => 'timestamp',
 +
    type => 'time',
 +
    render_style => 'short',
 +
}
 +
Render date and time in short form.
 +
{
 +
    name => 'datestamp',
 +
    type => 'time',
 +
    render_style => 'short',
 +
}
 +
Require minimum resolution to be to the hour.
 +
{
 +
    name => 'timestamp',
 +
    typ e=> 'time',
 +
    min_resolution => 'hour',
 +
}

Latest revision as of 12:20, 16 April 2023

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


Metadata Fields: Arclanguage - Base64 - Bigint - Boolean - Compound - Counter - Dataobjref - Date - Decimal - Email - Fields - Float - Id - Idci - Image - Int - Itemref - Keywords - Langid - Longtext - Longtext_counter - Multilang - Multipart - Name - Namedset - Pagerange - Recaptcha - Relation - Search - Secret - Set - Storable - Subject - Subobject - Text - Time - Timestamp - Url - Uuid


Description

This field is very similar to date field but allows the inclusion of hours, mintues and seconds. It is used for the various timestamps associated with an eprint record.

Times are always stored in UTC and rendered in the local timezone.

Inheritance

Additional Properties

Same as Date fields except for

Name Default Value Required? Description Notes
min_resolution second NO Indicates the smallest unit of measure that must be entered to make a value valid. Can be second, minute, hour, day month or year. Different from Date field default (day). E.g. day indicates year, month and day are required and hour, minute and second are optional.
render_res second NO Indicates the smallest unit of time that should be rendered for the value. an be second, minute, hour, day month or year. Different from Date field default (day). This is not too useful in configuring the field, but can be set as a print option inside citation files. Although it can be handy to store the time right down to the second, you often will just want to render the hours and minutes for day to day use.
render_style long NO Whether to render time in long or short format. Same default value as Date field. However, if long then renders like 8 September 1998 23:12:11 +01:00. If short then renders like 08 Sep 1998 23:12:11.

Required Phrases

No additional phrases beyond those required for Date fields.

Database

fieldname_year SMALLINT(6)
fieldname_month SMALLINT(6)
fieldname_day SMALLINT(6) 
fieldname_hour SMALLINT(6)
fieldname_minute SMALLINT(6)
fieldname_second SMALLINT(6)

API

See API page.

Examples

Most basic example.

{
    name => 'timestamp',
    type => 'time',
}

Only render valyes down to the nearest minute.

{ 
    name => 'datestamp',
    type => 'time',
    render_res => 'minute',
}

Render date and time in short form.

{
    name => 'timestamp',
    type => 'time',
    render_style => 'short',
}

Render date and time in short form.

{
    name => 'datestamp',
    type => 'time',
    render_style => 'short',
}

Require minimum resolution to be to the hour.

{
    name => 'timestamp',
    typ e=> 'time',
    min_resolution => 'hour',
}