Focal Point Banner
Community Center Education Summit Technical Support User Groups
Let's Get Social!

Facebook Twitter LinkedIn YouTube
Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [SOLVED] BOTSIT NEXTRUNTIME convert to datetime?
Go
New
Search
Notify
Tools
Reply
  
[SOLVED] BOTSIT NEXTRUNTIME convert to datetime?
 Login/Join
 
Platinum Member
posted
I'm trying to get my head around this -- I'm not familiar with Zulu or UTC time fields, which is what I believe the NEXTRUNTIME field is, although the format of the field is A32V (according to the ?FF I ran).
How can I get this to show on a report in HMDYY format? I have just been using code, but I suppose I could convert to SQL pass-thru. I'm just trying to get a list of reports with a future NEXTRUNTIME.
Thanks!
--Deb

This message has been edited. Last edited by: DWaybright,


WebFOCUS 8.2.03 (production), 8.2.06 (testing)
AppStudio, InfoAssist
Windows, All Outputs
 
Posts: 172 | Location: Indiana | Registered: December 05, 2017Reply With QuoteReport This Post
Virtuoso
posted Hide Post
Those numbers don't look like Zulu time.


WebFOCUS 8206, Unix, Windows
 
Posts: 1822 | Location: New York City | Registered: December 30, 2015Reply With QuoteReport This Post
Virtuoso
posted Hide Post
Deb

I found this code on techsupport, don't make me explain why it works but it does...


JOIN SCHEDULEID IN BOTSCHED TO UNIQUE SCHEDULEID IN BOTSIT
DEFINE FILE BOTSCHED
NUM_NEXTRUNTIME/D14 WITH NEXTRUNTIME = EDIT(NEXTRUNTIME) ;
START_DATE/I8YYMD WITH NEXTRUNTIME = 19700101;
SMART_START/YYMD=START_DATE;
CASTER_START/HYYMDIA = HDTTM(SMART_START, 8, 'HYYMDIA');
NEXT_RUNTIME/HYYMDIA = HADD(CASTER_START,'MILLISECONDS', NUM_NEXTRUNTIME, 8, 'HYYMDIA');
END
TABLE FILE BOTSCHED
PRINT NEXT_RUNTIME
BY SCHEDULEID
END


Thank you for using Focal Point!

Chuck Wolff - Focal Point Moderator
WebFOCUS 7x and 8x, Windows, Linux All output Formats
 
Posts: 1820 | Location: Customer Support | Registered: April 12, 2005Reply With QuoteReport This Post
Master
posted Hide Post
It looks like it is using The ECMAScript epoch and timestamps, which is the number of milliseconds that have elapsed since midnight on January 1, 1970, UTC.

January 1, 1970, UTC is the same as the UNIX epoch, which is the predominant base value for computer-recorded date and time values.

Open the dev tools in a browser, go to the console and enter
  
new Date( [value of NEXTRUNTIME] ) 
You will see the date.

**EDIT
Unless NEXTRUNTIME = '00000000000009223372036854775807' in which case it means NEXTRUNTIME = 'never'

So, looking at Chuck's code above, it is converting the string to a number and adding that number of miliseconds to the UNIX epoch of January 1, 1970, UTC.

This message has been edited. Last edited by: Hallway,


Hallway
WF(Prod):8202M1
WF(Test):8202M4
OS/Platform:Win 10
Outputs:All
 
Posts: 561 | Location: Salt Lake City, UT, USA | Registered: November 18, 2015Reply With QuoteReport This Post
Platinum Member
posted Hide Post
Chuck -- Thanks! That gave me what I needed.
Hallway -- Thanks for the explanation. I do appreciate knowing why something works and what I'm really looking at.

--Deb


WebFOCUS 8.2.03 (production), 8.2.06 (testing)
AppStudio, InfoAssist
Windows, All Outputs
 
Posts: 172 | Location: Indiana | Registered: December 05, 2017Reply With QuoteReport This Post
Virtuoso
posted Hide Post
Hallway

I thank you as well for the explanation, I had no idea why they picked that date to add to the field value... Learn something new everyday..


Thank you for using Focal Point!

Chuck Wolff - Focal Point Moderator
WebFOCUS 7x and 8x, Windows, Linux All output Formats
 
Posts: 1820 | Location: Customer Support | Registered: April 12, 2005Reply With QuoteReport This Post
Expert
posted Hide Post
@ Chuck,

There used to be an article that explained this (and other tips and techniques) but I can't locate any of them now.

Any idea what happened to them? If they're still accessible and where?

T
 
Posts: 5662 | Location: United Kingdom | Registered: April 08, 2004Reply With QuoteReport This Post
Expert
posted Hide Post
Ummm, scratch that, just need to click on the "Community Center" link at the top of this page and then choose "Tips and Techniques" from the bottom link in the centre of the "Forum Highlights" section.
Zulu Time - How to Read the ReportCaster Schedule File


T



In FOCUS
since 1986
WebFOCUS Server 8.2.01M, thru 8.2.07 on Windows Svr 2008 R2  
WebFOCUS App Studio 8.2.06 standalone on Windows 10 
 
Posts: 5662 | Location: United Kingdom | Registered: April 08, 2004Reply With QuoteReport This Post
Expert
posted Hide Post
In addition to the article written by Susannah in 2003(?), You can obtain an indicator whether the current time zone is affected by daylight saving.

This is what I use -

-* Call reg.exe to obtain the current time offset due to BST
CMD REG QUERY HKLM\SYSTEM\CURRENTCONTROLSET\CONTROL\TIMEZONEINFORMATION /V ACTIVETIMEBIAS > TZ.TXT
-RUN
-* Allocate the timezone data so that we can read the values
FILEDEF TZDATA DISK TZ.TXT (LRECL 80 RECFM V
-RUN

-* Read the values from the line containing the word 'ACTIVETIMEBIAS'
-:LAB_000;
-READ TZDATA &TZDATA.A80.
-IF &TZDATA OMITS 'ACTIVETIMEBIAS' THEN GOTO :LAB_000;
-SET &HEXVAL = GETTOK(&TZDATA, 80, -1, 'x', 10, 'A10');

-* Using the returned hexadecimal value, determine the epoch time to feed into the conversion
-* of the START_STAMP which is a count of milliseconds since the epoch time.
-*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-* WARNING: As the machine current time offset is used, any data that is loaded COULD be
-* an hour out.
-*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-SET &EPOCH = DECODE &HEXVAL('ffffffc4' '19700101 01:00:00' ELSE '19700101 00:00:00');
-TYPE The EPOCH time being used is &EPOCH.EVAL


and then in a define -

  EPOCH/HYYMDs          = HINPUT(&EPOCH.LENGTH, &EPOCH.QUOTEDSTRING, 8, 'HYYMDs');
  BEG_TIMESTAMP/HYYMDs 	= IF START_STAMP NE '' THEN HADD(EPOCH, 'ms', EDIT(START_STAMP), 8, BEG_TIMESTAMP) ELSE EPOCH;
  END_TIMESTAMP/HYYMDs 	= IF END_STAMP   NE '' THEN HADD(EPOCH, 'ms', EDIT(END_STAMP), 8, END_TIMESTAMP) ELSE EPOCH;


T



In FOCUS
since 1986
WebFOCUS Server 8.2.01M, thru 8.2.07 on Windows Svr 2008 R2  
WebFOCUS App Studio 8.2.06 standalone on Windows 10 
 
Posts: 5662 | Location: United Kingdom | Registered: April 08, 2004Reply With QuoteReport This Post
Expert
posted Hide Post
I should add the fact that I use GMT so I don't have to worry about time zones other than when we are in BST (British Summer Time).

You can derive the time zone information from the first section.

There was an article by John Gray (JG) that gave examples etc. here

T



In FOCUS
since 1986
WebFOCUS Server 8.2.01M, thru 8.2.07 on Windows Svr 2008 R2  
WebFOCUS App Studio 8.2.06 standalone on Windows 10 
 
Posts: 5662 | Location: United Kingdom | Registered: April 08, 2004Reply With QuoteReport This Post
  Powered by Social Strata  
 

Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [SOLVED] BOTSIT NEXTRUNTIME convert to datetime?

Copyright © 1996-2018 Information Builders, leaders in enterprise business intelligence.