Kevin McGinn · Mar 9, 2022

Python script to perform $ZDATE function

I have a python script that is pulling the cache instance key expiration date ( KeyExpirationDate() ) which comes back as an integer. With the queryscript function - $ZDATE(73284) I can derive the actual expiration date. Is there a manner or method of creating an equivalent Python script that will convert the integer return by the KeyExpirationDate()  method into a date string?

Product version: Caché 2018.1
1 182
Discussion (1)1
Log in or sign up to continue

Use this:

import datetime
horolog = 66177

fromordinal counts days from 1st Jan 1, $horolog counts days from 1st Jan 1841, so to get ordinal date from horolog date you need to add ordinal value of 31st Dec 1840 which is 672046.