User bio
404 bio not found
Member since Jun 29, 2022
Replies:
ClassMethod ConvertAthenaTimes(pDate As %String = "", pStartTime As %String = "", pDuration As %String = "", pTZ As %String = "") As %String
{
    //Set Defaults and Return if no Values Passed in
    Set return = ""
    q:pDate="" return
    q:pStartTime="" return
    //Convert pDuration into Seconds
    s:pDuration]"" pDuration=pDuration*60
    s dt=$zdth(pDate_" "_pStartTime_pTZ,1,5)
    if pDuration set $p(dt,",",2)=$p(dt,",",2)+pDuration
    set return=$zdt(dt_pTZ,3,5)

    // do something
    q return
}

ClassMethod TestFunction()
{
    try{
        w ##class(SERVICESVCPKG.Model.Functions.ProcessFunctions).ConvertAthenaTimes("7/21/2022","08:00",30,"-05:00")
    }catch(ex){
    #dim ex As %Exception.AbstractException
    w ex.DisplayString()
    }
}

I made a few tweaks and got to this:

2022-07-21T08:30:00+00:00

Not Quite sure how to get that TZ to change outside of changing the display format and just appending the pTZ parameter which would work. Not sure if $ZDATETIMEH handles time zone conversions when going from internal time or not. 

Thank you both so much! Now to figure out how to do this with embedded objects. For my destination objects. 

I'd imagine I'd define in my parent class

Property ExternalAlias As SERVICESVCPKG.Model.IntSvc.ExternalAlias(%JSONFIELDNAME = "ExternalAlias", %JSONINCLUDE = "inout");
Class SERVICESVCPKG.Model.IntSvc.ExternalAlias Extends (%SerialObject, %JSON.Adaptor)
{

Parameter %JSONENABLED = 1;

Property TenantID As %String(%JSONFIELDNAME = "TenantID", %JSONINCLUDE = "inout");

Property SystemID As %String(%JSONFIELDNAME = "SystemID", %JSONINCLUDE = "inout");

Property ExternalType As %String(%JSONFIELDNAME = "ExternalType", %JSONINCLUDE = "inout");

Property ExternalID As %String(%JSONFIELDNAME = "ExternalID", %JSONINCLUDE = "inout");

}

Thank you all again, I swear I've been banging my head against this for like a week with 10 tabs of docs open. 

Certifications & Credly badges:
Victor has no Certifications & Credly badges yet.
Global Masters badges:
Victor has no Global Masters badges yet.
Followers:
Victor has no followers yet.
Following:
Victor has not followed anybody yet.