Difference between revisions of "Date and Time formats in Content Manager OnDemand"

Updated all sections, provided more arsdate examples, linked to the CMOD knowledgebase.
(Updates to IBM CMOD arsdate command & date formats.)
(Updated all sections, provided more arsdate examples, linked to the CMOD knowledgebase.)
Line 17: Line 17:
The old formats are simply stored as integers.  Searching OnDemand through [[arsdoc query]] will perform the conversion to a human readable format, as per the IBM CMOD Folder Definition.  But if you need to convert from an OnDemand date format into a human readable format, you can use the arsdate command.
The old formats are simply stored as integers.  Searching OnDemand through [[arsdoc query]] will perform the conversion to a human readable format, as per the IBM CMOD Folder Definition.  But if you need to convert from an OnDemand date format into a human readable format, you can use the arsdate command.


IBM Content Manager OnDemand's arsdate utility will assist in converting date formats from the command line (see below for IBM CMOD's arsdate examples):
IBM Content Manager OnDemand's arsdate utility will assist in converting date formats from the command line.
 
=== IBM CMOD arsdate examples ===


   # Convert from a CMOD internal date format to a human readable date:
   # Convert from a CMOD internal date format to a human readable date:
   # arsdate -a 17034
   $ arsdate -a 17034
   17034 -> 08/20/16
   17034 -> 08/20/16
  # Convert from a human readable date to the IBM CMOD internal date format:
  $ arsdate -a 11/28/16
  11/28/16 -> 17134


   # Convert from a CMOD internal time format to a human readable date & time format:
   # Convert from a CMOD internal time format to a human readable date & time format:
   # arsdate -i 1489982862
   $ arsdate -i 1489982862
   1489982862 -> 03/20/17 04:07:42
   1489982862 -> 03/20/17 04:07:42


   # Convert from a human readable date to the IBM CMOD internal date format:
   # Convert from a human readible date to IBM CMOD time format:
   # arsdate -a 11/28/16
  $ arsdate -i 11/28/16
   11/28/16 -> 17134
  11/28/16 -> 1480291200-1480377599
The reason that CMOD provides a range for this result is that the integer number '1480291200' represents midnight of November 28th, 2016, and '1480377599' represents 23:59:59 (the last second before midnight) on November 28th, 2016. By including the time, and surrounding the date & time argument in quotes, you can get a specific time, down to the second:
 
  # Convert from a human readible date *and* time to IBM CMOD internal time format:
   $ arsdate -i "11/28/16 13:42:19"
   11/28/16 13:42:19 -> 1480340539
The quotes are necessary, so that arsdate doesn't try to interpret 13:42:19 as a date.  If you forget the quotes, you get odd results:


== New Formats ==
  # Oops, you forgot to put quotes (") around the timestamp.
The new date/time formats introduced in IBM CMOD v9.5 use the native date/time fields in your chosen database engine.  This greatly simplifies date & time calculations and queries, as the database can use highly optimized search functions to complete user requests.  Unfortunately, OnDemand Application Group data will need to be migrated to use these new date formats, which is best done at the time of an upgrade or data migration. Another improvement is that native database date formats support a MUCH wider range of dates.  Prior to IBM CMOD v9.5, the range of dates that could be stored in CMOD were from 1970 until 2070 for date fields, and from 1970 to 2038 for date/time fields.  Now, with OnDemand's date formats,
  $ arsdate -i 11/28/16 13:42:19
  11/28/16 -> 1480291200-1480377599
  13:42:19 -> -1


== New IBM CMOD Date Formats ==
The new date/time formats introduced in IBM CMOD v9.5 use the native date/time fields in your chosen database engine.  This greatly simplifies date & time calculations and queries, as the database can use highly optimized search functions to complete user requests.  Unfortunately, OnDemand Application Group data will need to be migrated to use these new date formats, which is best done at the time of an upgrade or data migration.  Another improvement is that native database date formats support a MUCH wider range of dates.  Prior to IBM CMOD v9.5, the range of dates that could be stored in CMOD were from 1970 until 2070 for date fields, and from 1970 to 2038 for date/time fields.  Most native database date/time fields not only support years from 0000 to 9999, they also have accuracy down to a millionth of a second.


== Converting Between Old and New ==
== Converting Between Old and New ==
In order to convert from the old date formats to the new ones, add the -C option to your arsdate command.  Depending on your database and your language settings, your results may be formatted differently.
  $ arsdate -C -i 1489982862
  1489982862 -> 03/20/17 04:07:42
  $ arsdate -C -a 17034
  17034 -> 08/20/16


=== IBM CMOD arsdate command ===
=== IBM CMOD arsdate command ===
Line 62: Line 85:
     -1 <trace_file>  Trace file
     -1 <trace_file>  Trace file
     -2 <trace_level> Trace level
     -2 <trace_level> Trace level
== More examples ==
[https://www.ibm.com/support/knowledgecenter/SSEPCD_10.1.0/com.ibm.ondemand.administeringmp.doc/dodda003.htm IBM CMOD Knowledgebase: arsdate parameters]
[https://www.ibm.com/support/knowledgecenter/SSEPCD_10.1.0/com.ibm.ondemand.administeringmp.doc/dodda004.htm IBM CMOD Knowledgebase: arsdate examples]