Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: MAG7UD

MAG7UD.m

Go to the documentation of this file.
  1. MAG7UD ;WOIFO/MLH - Imaging - HL7 - utilities - dates ; 11/15/2006 08:35
  1. ;;3.0;IMAGING;**49**;Mar 19, 2002;Build 2033;Apr 07, 2011
  1. ;; Per VHA Directive 2004-038, this routine should not be modified.
  1. ;; +---------------------------------------------------------------+
  1. ;; | Property of the US Government. |
  1. ;; | No permission to copy or redistribute this software is given. |
  1. ;; | Use of unreleased versions of this software requires the user |
  1. ;; | to execute a written test agreement with the VistA Imaging |
  1. ;; | Development Office of the Department of Veterans Affairs, |
  1. ;; | telephone (301) 734-0100. |
  1. ;; | The Food and Drug Administration classifies this software as |
  1. ;; | a medical device. As such, it may not be changed in any way. |
  1. ;; | Modifications to this software may result in an adulterated |
  1. ;; | medical device under 21CFR820, the use of which is considered |
  1. ;; | to be a violation of US Federal Statutes. |
  1. ;; +---------------------------------------------------------------+
  1. ;;
  1. Q
  1. ;
  1. STRIP0(XDATELOC) ; FUNCTION - strip zeros off HL7 dates
  1. ; input: XDATELOC variable containing any 8-digit HL7 date with or w/o TZ offset (+/-ZZZZ)
  1. ; function return: always 0 (success)
  1. ;
  1. N MAGDATE ; -- working date
  1. N OFSGN ; ---- offset sign
  1. N TZ ; ------- time zone offset
  1. ;
  1. ; '*' for offset sign means there isn't one, but the date is valid
  1. S MAGDATE=@XDATELOC
  1. S OFSGN=$S(MAGDATE?1.N1"-"1.N:"-",MAGDATE?1.N1"+"1.N:"+",MAGDATE?1.N:"*",1:"")
  1. I OFSGN="" Q ""
  1. S TZ=$P(MAGDATE,OFSGN,2),MAGDATE=$P(MAGDATE,OFSGN,1)
  1. I MAGDATE?6N1"00" S MAGDATE=MAGDATE/100
  1. I MAGDATE?4N1"00" S MAGDATE=MAGDATE/100
  1. S @XDATELOC=MAGDATE_$S(OFSGN'="*":OFSGN,1:"")_TZ
  1. Q 0 ; success always