How to convert Satellite API date times

Solution Verified - Updated -


  • Red Hat Network (RHN) Satellite 5.4.1


  • Satellite API returns most time values in Frontier::RPC2::DateTime::ISO8601 format and need to format these values to a more friendly format.


  • obtain a iso8601 object from RHN API call
my $dt = $system->{'last_checkin'};
  • use the value() subroutine
print "Raw time is " . $dt->value();
  • unpack may be used to futher format output
my $fdt = sprintf("%d-%02d-%02d%s%s", unpack('A4A2A2AA8', $dt->value()));
print "\nFormatted time is $fdt\n";
  • Use the xmlrpc library to create dates to send to the API:
my $start = $client->date_time(strftime("%Y%m%dT%H:%M:%S", localtime(time() - 518400)));
my $stop = $client->date_time(strftime("%Y%m%dT%H:%M:%S", localtime(time())));

my $s = { 'startDate' => $start, 
          'endDate' => $stop

my $result = $client->call('system.provisioning.snapshot.deleteSnapshots', $session, $sid, $s);


Root Cause

  • ISO8601 dates are not in a human-readable value for customers

Diagnostic Steps

  • confirm object types (Frontier::RPC2::DateTime::ISO8601) are being returned instead of human-friendly dates

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.


verified by customer for 00612273