Julian Date conversion for current year

Clovertech Forums Read Only Archives Cloverleaf Cloverleaf Julian Date conversion for current year

  • Creator
    Topic
  • #55028
    Don Anderson
    Participant

      Im trying to convert the julian day of the current year and havent had much luck.

      i.e 20160316 YYMMDD need to be converted to 16082 YYJJJ

      Any suggestions

    Viewing 6 reply threads
    • Author
      Replies
      • #83830
        James Cobane
        Participant

          Don,

          If you are doing this within an Xlate and your fields are defined as the respective date formats, the engine should handle the conversion for you.

        • #83831
          Don Anderson
          Participant

            I’m doing it withing a TPS sript as part of a file name requirment by the state of Texas. They insiste the file name have that format appended to the file name

          • #83832
            Don Anderson
            Participant

              Im not sure how you got 76

              Jan   31

              Feb   29

              Mar   22

                    =82

            • #83833
              Don Anderson
              Participant

                This gave me the expected result

                      set TS [fmtclock [getclock] %y%m%d]

                      set TSJ [clock format [clock scan $TS] -format %y%j]

                      set fileout SHFCGALV${TSJ}.HL7

                SHFCGALV16082.HL7

                Texas Immunization Reporting

              • #83834
                James Cobane
                Participant

                  The Julian day for 3/16/2016 should be 076 (which is the date you show in your example: “20160316”), the Julian day for 3/22 (today) is 082.

                  Thanks,

                  Jim Cobane

                  Henry Ford Health

                • #83835
                  Charlie Bursell
                  Participant

                    Use clock command

                  • #83836
                    Charlie Bursell
                    Participant

                      After reading more I am really confused as to what you want here.

                      You say you have input data 20160316 (YYYYMMDD) which needs to be converted to julian date.

                      Which one?  two types of julian dates

                          1. A three-digit number giving the day of the year (001-366).

                          2. The Julian Day Number is a count of the number of calendar days that have elapsed since 1 January, 4713 BCE of the proleptic Julian calendar. The epoch time of 1 January 1970 corresponds to Julian Day Number 2440588.

                      #1

                      clock format [clock scan $dt ] -format “%j  %Y”

                      ==? 076  2016

                      #2

                      clock format [clock scan $dt ] -format “%J %y”

                      ==> 2457464 16

                      Is this what you want?  Adjust formatting characters to match what you need.

                  Viewing 6 reply threads
                  • The forum ‘Cloverleaf’ is closed to new topics and replies.