Figure 2-10. Converting Timestamps - HP TACL Programming Manual

Tandem advanced command language
Table of Contents

Advertisement

Converting Timestamps Into Different Formats
The macro in Figure 2-10, getdates, converts the current date from a three-word
timestamp to SQL format (yyyy-mm-dd), for use by report generators or other
programs. This type of macro could be used to generate SQL reports.
Figure 3-9 in Section 3, "Developing TACL Routines," contains a modification of this
example that shows how a nested routine can return dates as results.

Figure 2-10. Converting Timestamps

?SECTION getdates MACRO
#FRAME
== Save the current setting of #OUTFORMAT,
== so that it can be restored later:
#PUSH #OUTFORMAT #INFORMAT
[#PUSH
date
yyyy
mm
dd
]
#SET #OUTFORMAT PRETTY
== Get the date and convert to yyyy mm dd calendar format:
#SETMANY yyyy mm dd, [#CONTIME [#TIMESTAMP]]
== Store as yyyy-mm-dd format (SQL date format):
#SET date [yyyy]-[mm]-[dd]
== Display the results to the user
#OUTPUT The reports will use a date of [date]
{ place report-generation code here}
#UNFRAME
107365 Tandem Computers Incorporated
== starting date (30 days ago)
== year
== month
== day
Developing TACL Programs
Accessing Time Data
2–23

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents