Discussion:
HP tandem Cobol85 convert date-time to timestamp
(too old to reply)
Memmedaga Memmedov
2021-07-08 13:26:33 UTC
Permalink
Hi,
I can create timestamp value in realtime using "ENTER TAL "JULIANTIMESTAMP" GIVING S-TIMESTAMP"
For example, timestamp 212492402667471197 date 20210707 time10242747
Now, I want to create timestamp value using input date and time.
I mean date 20190101 time 23595900, I want to find what was timestamp value for previous dates?
Bill Honaker
2021-07-08 16:51:48 UTC
Permalink
Post by Memmedaga Memmedov
Hi,
I can create timestamp value in realtime using "ENTER TAL "JULIANTIMESTAMP" GIVING S-TIMESTAMP"
For example, timestamp 212492402667471197 date 20210707 time10242747
Now, I want to create timestamp value using input date and time.
I mean date 20190101 time 23595900, I want to find what was timestamp value for previous dates?
Go online to the HPE Manuals website (https://www.hpe.com/info/nonstop-docs), and choose the proper (NonStop L-Series or NonStop J-Series, for example).

Search for and download 2 manuals, 'Guardian Programmer's Guide' and 'Guardian Procedure Calls Reference Manual'.

Find the chapter in the Programmer's Guide called 'Managing Time', it will discuss a lot of these concepts.

Note that if your system is located in a zone that observes Daylight Savings, or Summer, time, historical timestamps may have some anamolies.

The JULIANTIMESTAMP you retrieved represents a GMT time, not a Local time. So as you determine the JTS for a time in the past,
keep in mind you will have to do some conversions.

The section of that chapter you need is 'Converting Between a Julian Timestamp and a Gregorian Date and Time'.
In particular, the example of COMPUTETIMESTAMP and CONVERTTIMESTAMP.

If you need to deal with the time in other time zones, it gets a lot more complex. I've used the C Runtime library's time functions to help that,but you will
find there's a lot of trial and error involved. Temporal mechanics, even on just our one world, is NOT for the faint of heart.

Good luck,
Bill
Memmedaga Memmedov
2021-07-10 19:19:20 UTC
Permalink
@Bill, thanks for your support. As you said, I wrote small C code using COMPUTETIMESTAMP command for converting Gregorian to Julian Timestamp. Then called c function from cobol program. It was 3 hours between converting timestamps, no problem I calculated it. Solved.
wbreidbach
2021-08-26 13:31:42 UTC
Permalink
Post by Memmedaga Memmedov
@Bill, thanks for your support. As you said, I wrote small C code using COMPUTETIMESTAMP command for converting Gregorian to Julian Timestamp. Then called c function from cobol program. It was 3 hours between converting timestamps, no problem I calculated it. Solved.
You should be aware that JULIANTIMESTAMP always returns a GMT-timestamp. You need CONVERTTIMESTAMP to convert it to a local timestamp. If the timezone of your system has not been correctly configured you might experience some mysterious problems. You can check that using SCF INFO SUBSYS $ZZKRN. There is a line containing the timezone offset.
Loading...