-----------------------------------------------------------

New Message on BDOTNET

-----------------------------------------------------------
From: venkat
Message 5 in Discussion


Hi The number it was give is Julian 
number,  That number will give the Julian calendar start data. I think this 
will help you to convert the Julian number to Date.
 
The sample program will take Date and 
convert to Julian number and reverse. I hope this will solve ur 
problem.
 
Best regards,
venkat.
 
#include <math.h>
#include <stdio.h>

/* Oct. 15, 1582 */
#declare IGREG (15+31L*(10+12L*1582))

long date_to_julian (int mon, int day, int year) {

  long jul;
  int ja;
  int jy = year;
  int jm;

  if (jy == 0) return(0);
  if (jy < 0) jy++;

  if (mon > 2)
    jm = mon + 1;
  else {
    jy--;
    jm = mon + 13;
  }

  jul = (long) (floor(365.25 * jy) + floor(30.6001 * jm) + day + 1720995);

  if (day + 31L * (mon + 12L * year) >= IGREG) {
    ja = (int)(0.01 * jy);
    jul += 2 - ja + (int) (0.25 * ja);
  }

  return(jul);
}


void julian_to_date(long julian, int *mon, int *day, int *year) {

  long ja, jalpha, jb, jc, jd, je;

  if (julian >= IGREG) {
    jalpha = (long) (((float) (julian - 1867216) - 0.25) / 36524.25);
    ja = julian + 1 + jalpha - (long) (0.25 * jalpha);
  } else
    ja = julian;

  jb = ja + 1524;
  jc = (long) (6680.0 + ((float) (jb - 2439870) - 122.1) / 365.25);
  jd = (long) (365 * jc + (0.25 * jc));
  je = (long) ((jb - jd) / 30.6001);
  *day = jb - jd - (long) (30.6001 * je);
  *mon = je - 1;
  if (*mon > 12) *mon -= 12;
  *year = jc - 4715;
  if (*mon > 2) (*year)--;
  if (*year <= 0) (*year)--;
}


  -----Original Message-----
From: BDOTNET 
  [mailto:[EMAIL PROTECTED]
Sent: Friday, January 02, 2004 1:24 
  PM
To: BDOTNET
Subject: Re: int ->Date 
  time?


  
    
      
      New Message on BDOTNET
    
      

  int 
    ->Date time?


    
      
      
        Reply

        
          
            
            
               
              Recommend 
              Message 3 in 
                Discussion 
      
        
          
            
            
              From: 54n7y 
            
              

                Hi Kalpesh,
                 
                The vendor says 1067625000 is the number for 
                1stNov2003
                 
                I have just reached the next phase:
                SELECT 
                DATEADD("s",((dateTimeOrigination/1000)+19800),'1900-01-01 
                00:00:00') 
from temp_doc
                 
                I am getting some output but the output is not 
                correct.
                For example:
                SELECT DATEADD("s",((1067625000/1000)+19800),'1900-01-01 
                00:00:00') 
                output:
                1900-01-13 14:03:45.000

                Actually we should get 2003-01-11 right!
                 
                Please assist!
                 
                Truly,
                Santy

View other groups in this 
    category. 



-----------------------------------------------------------

To stop getting this e-mail, or change how often it arrives, go to your E-mail 
Settings.
http://groups.msn.com/bdotnet/_emailsettings.msnw

Need help? If you've forgotten your password, please go to Passport Member Services.
http://groups.msn.com/_passportredir.msnw?ppmprop=help

For other questions or feedback, go to our Contact Us page.
http://groups.msn.com/contact

If you do not want to receive future e-mail from this MSN group, or if you received 
this message by mistake, please click the "Remove" link below. On the pre-addressed 
e-mail message that opens, simply click "Send". Your e-mail address will be deleted 
from this group's mailing list.
mailto:[EMAIL PROTECTED]

Reply via email to