Thread: Datetime conversion to julian date in C

  1. #1
    Registered User
    Join Date
    Jun 2012
    Posts
    5

    Datetime conversion to julian date in C

    Hi

    I have a date 2000-10-31 15:33:15.7556.

    I want to convert this date to julian date in C.

    Please help..

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    Julian day - Wikipedia, the free encyclopedia

    Now read this
    Announcements - C Programming

    > I have a date 2000-10-31 15:33:15.7556.
    OK, so at least post some code which results in a number of variables where say
    int year;
    ends up with the value 2000
    int month;
    ends up with the value 10
    and so on.

    Don't just dump your assignment and expect a code answer.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  3. #3
    Registered User
    Join Date
    May 2012
    Posts
    1,066
    Conversion formula

    So where is your problem (except using basic search skills)?

    Bye, Andreas

  4. #4
    Registered User
    Join Date
    Jun 2012
    Posts
    5
    Sorry guys for less information about the problem I am facing.

    My code was using CT library to connect to Sybase database. Now database is migrated to MS Sql Server and I am using unixODBC to connect to the MS Sql Server database.

    The datatime structure in CT library is different from its corresponding datetime structure in unixODBC.

    e.g
    Code:
    CT-lib structure
    struct date
    {
    int days;
    int time;
    }
    
    odbc datetime structure
    struct date
    {
    int year;
    int month;
    int day;
    .
    .
    
    }
    I am trying to achive conversion between them. I am only changing data layer. So my flow will beas

    CT-Lib datetime structure -> odbc Data layer (This handles datetime structure conversion) -> Ms Sql Server

    this happens vice-versa too.

    Note: I am .NET guy. I Never worked on C programming.

  5. #5
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    > Note: I am .NET guy. I Never worked on C programming.
    So what is your exact question anyway?

    I mean, you could have scrolled down to Gregorian_calendar_from_Julian_day_number and have an algorithm.

    Mathematical operators are the same in pretty much any programming language, so even half a day with a C book should give you enough syntax to at least ATTEMPT some kind of code.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Getting only Date by using DateTime ?
    By Aga^^ in forum C# Programming
    Replies: 3
    Last Post: 02-11-2009, 01:20 AM
  2. Formula to convert Calaneder Date to Julian ?
    By colmustang in forum C Programming
    Replies: 2
    Last Post: 03-21-2008, 05:17 AM
  3. date to unix time conversion
    By esaptonor in forum C++ Programming
    Replies: 2
    Last Post: 06-03-2007, 03:08 AM
  4. Date conversion
    By kevinh in forum C Programming
    Replies: 2
    Last Post: 01-10-2006, 10:19 PM
  5. Julian day of year
    By marcelowuo in forum C Programming
    Replies: 6
    Last Post: 06-15-2005, 05:11 PM

Tags for this Thread