Calc Julian Date Time - CSharp System

CSharp examples for System:DateTime Convert

Description

Calc Julian Date Time

Demo Code


using System.Collections.Generic;
using System;/*www  .j  ava2s.c  om*/

public class Main{
        static double CalcJulianDateTime(DateTime dt, double ut) {
            double mon = dt.Month > 2 ? dt.Month : dt.Month + 12;
            double yr = dt.Month > 2 ? dt.Year : dt.Year - 1;
            double var = 365.0 * yr - 679004.0;
            double b = (int)(yr / 400) - (int)(yr / 100) + (int)(yr / 4);
            double res = var + b + (int)(306001.0 * (mon + 1) / 10000) + dt.Day;
            return res + ut / 24.0;
        }
}

Related Tutorials