SPSS Statistics

SPSS Statistics

Your hub for statistical analysis, data management, and data documentation. Connect, learn, and share with your peers! 

 View Only
  • 1.  I'm looking for help converting Gregorian calendar dates to Julian calendar dates.

    Posted Mon August 29, 2022 04:58 PM
    I'm looking for help converting Gregorian calendar dates to Julian calendar dates.

    ------------------------------
    Will Johnson
    ------------------------------

    #SPSSStatistics


  • 2.  RE: I'm looking for help converting Gregorian calendar dates to Julian calendar dates.

    Posted Fri September 02, 2022 02:53 PM
    Edited by System Admin Fri January 20, 2023 04:19 PM

    Hi Will,

    Do your Gregorian dates already exist in an SPSS Statistics data file (*.sav)?  If so, converting from Gregorian to Julian should be a simple change of display formatting.

    DATA LIST FREE /today (ADATE10).
    BEGIN DATA
    09/02/2022
    END DATA.
    LIST.
    COMPUTE julian_today = today.
    FORMATS julian_today (JDATE7).
    LIST.

    Here is a reference for that example:  https://www.ibm.com/docs/en/spss-statistics/28.0.0?topic=formats-date-time

    ------------------------------
    David Dwyer
    SPSS Technical Support
    IBM Software
    ------------------------------



  • 3.  RE: I'm looking for help converting Gregorian calendar dates to Julian calendar dates.

    Posted Wed October 19, 2022 09:15 AM

    Formula for Conversion:

    Conversion of Gregorian calendar date to Julian date for years AD 1801–2099 can be carried out with the following formula:

    JD = 367K - <(7(K+<(M+9)/12>))/4> + <(275M)/9> + I + 1721013.5 + UT1/24
    - 0.5sign(100K+M-190002.5) + 0.5

    where K is the year (1801 <= K <= 2099), M is the month (1 <= M <= 12), I is the day of the month (1 <= I <= 31), and UT is the universal time in hours ("<=" means "less than or equal to"). The last two terms in the formula add up to zero for all dates after 1900 February 28, so these two terms can be omitted for subsequent dates. This formula makes use of the sign and truncation functions described below:

    The sign function serves to extract the algebraic sign from a number.
    Examples: sign(247) = 1; sign(-6.28) = -1.

    The truncation function < > extracts the integral part of a number.
    Examples: <17.835> = 17; <-3.14> = -3.

    The formula given above was taken from the 1990 edition of the U.S. Naval Observatory's Almanac for Computers (discontinued).

    Example: Compute the JD 2023 calendar corresponding to 1877 August 11, 7h30m UT1.
    Substituting K = 1877, M = 8, I = 11 and UT1 = 7.5,
    JD = 688859 - 3286 + 244 + 11 + 1721013.5 + 0.3125 + 0.5 + 0.5
    = 2406842.8125



    ------------------------------
    Betina Jessen
    ------------------------------