Times and Dates
Times and Dates
The PTIME_STRUCTPtr, PDATE_STRUCTPtr, and PTIMESTAMP_STRUCTPtr packages are used to manipulate Caché %TIME, %DATE, or %TIMESTAMP datatypes.
%TIME
Methods of the PTIME_STRUCTPtr package are used to manipulate the Caché %DATE data structure. Times are in hh:mm:ss format. For example, 5 minutes and 30 seconds after midnight would be formatted as 00:05:30. Here is a complete listing of Time methods:
$time = PTIME_STRUCTPtr->new()
Create a new Time object.
$hour = $time->get_hour()
Return hour
$minute = $time->get_minute()
Return minute
$second = $time->get_second()
Return second
$time->set_hour($hour)
Set hour (an integer between 0 and 23, where 0 is midnight).
$time->set_minute($minute)
Set minute (an integer between 0 and 59).
$time->set_second($second)
Set second (an integer between 0 and 59).
$stringrep = $time->toString()
Convert the time to a string: hh:mm:ss.
%DATE
Methods of the PDATE_STRUCTPtr package are used to manipulate the Caché %DATE data structure. Dates are in yyyy-mm-dd format. For example, December 24, 2003 would be formatted as 2003-12-24. Here is a complete listing of Date methods:
$date = PDATE_STRUCTPtr->new()
Create a new Date object.
$year = $date->get_year()
Return year
$month = $date->get_month()
Return month
$day = $date->get_day()
Return day
$date->set_year($year)
Set year (a four-digit integer).
$date->set_month($month)
Set month (an integer between 1 and 12).
$date->set_day($day)
Set day (an integer between 1 and the highest valid day of the month).
$stringrep = $date->toString()
Convert the date to a string: yyyy-mm-dd.
%TIMESTAMP
Methods of the PTIMESTAMP_STRUCTPtr package are used to manipulate the Caché %TIMESTAMP data structure. Timestamps are in yyyy-mm-dd<space>hh:mm:ss.fffffffff. format. For example, December 24, 2003, five minutes and 12.5 seconds after midnight, would be formatted as:
2003-12-24 00:05:12:500000000
Here is a complete listing of TimeStamp methods:
$timestamp = PTIMESTAMP_STRUCTPtr->new()
Create a new Timestamp object.
$year = $timestamp->get_year()
Return year in yyyy format.
$month = $timestamp->get_month()
Return month in mm format.
$day = $timestamp->get_day()
Return day in dd format.
$hour = $timestamp->get_hour()
Return hour in hh format.
$minute = $timestamp->get_minute()
Return minute in mm format.
$second = $timestamp->get_second()
Return second in ss format.
$fraction = $timestamp->get_fraction()
Return fraction of a second in fffffffff format.
$timestamp->set_year($year)
Set year (a four-digit integer).
$timestamp->set_month($month)
Set month (an integer between 1 and 12).
$timestamp->set_day($day)
Set day (an integer between 1 and the highest valid day of the month).
$timestamp->set_hour($hour)
Set hour (an integer between 0 and 23, where 0 is midnight).
$timestamp->set_minute($minute)
Set minute (an integer between 0 and 59).
$timestamp->set_second($second)
Set second (an integer between 0 and 59).
$timestamp->set_fraction($fraction)
Set fraction of a second (an integer of up to nine digits).
$stringrep = $timestamp->toString()
Convert the timestamp to a string yyyy-mm-dd hh:mm:ss.fffffffff.