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]Get 12 hours ago from current datetime
Go
New
Search
Notify
Tools
Reply
  
[SOLVED]Get 12 hours ago from current datetime
 Login/Join
 
Gold member
posted
I need to get 12 hours ago from the current date time in date time format. After some searching i have the ability to get one day ago (below) however i would like to just specify 12 hours ago.

Example:
current datetime is 2016-04-19 21:00
then get variable for 2016-04-19 09:00

Example:
current datetime is 2016-04-19 10:00
then get variable for 2016-04-18 22:00

-*this is what i have for one day ago from current datetime, i'm not sure if i can build on it?
-SET &CURR_DT_RAW=HCNVRT(HGETC(20,'HYYMDS'),'(HYYMDS)',20,'A20');
-SET &CURR_DT=HCNVRT(HADD(HGETC(20,'HYYMDS'),'DAY',-1,8,'HYYMDS'),'(HYYMDS)',20,'A20');

This message has been edited. Last edited by: <Emily McAllister>,
 
Posts: 51 | Registered: November 30, 2012Reply With QuoteReport This Post
Master
posted Hide Post
Try this:

-SET &ECHO=ALL;
-SET &CURR_DT_RAW=HADD(HGETC(20,'HYYMDS'),'HOUR',-12,20,'HYYMDS');
-SET &CURR_DT_ALPHA=HCNVRT(&CURR_DT_RAW,'(H14)',14,'A14');
-TYPE &CURR_DT_ALPHA


App Studio
WebFOCUS 8.1.05M
Windows, All Outputs
 
Posts: 594 | Location: Michigan | Registered: September 04, 2015Reply With QuoteReport This Post
Gold member
posted Hide Post
quote:
l

Thanks Squatch, this works:

-SET &CURR_DT=HCNVRT(HADD(HGETC(20,'HYYMDS'),'HOUR',-12,8,'HYYMDS'),'(HYYMDS)',20,'A20');


WebFocus 8.02, SQL Server 2008r2
 
Posts: 51 | Registered: November 30, 2012Reply With QuoteReport This Post
Expert
posted Hide Post
Please add [SOLVED] or [CLOSED] to the title your first post in this thread.

This way we all know its been resolved.


Waz...

Prod:WebFOCUS 7.6.10/8.1.04Upgrade:WebFOCUS 8.2.05OS:LinuxOutputs:HTML, PDF, Excel, PPT
In Focus since 1984
Know The Code

 
Posts: 6053 | Location: Land of the Darug people, Terra Australis Incognita | Registered: October 31, 2006Reply With QuoteReport This Post
  Powered by Social Strata  
 

Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [SOLVED]Get 12 hours ago from current datetime

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