473,672 Members | 2,190 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Julian dates question

How may I represent dates as Julian dates - I have seen code where
julian dates are represented as longs, and other where they are
represented as floats. Which is the correct representation?

Anyone knows where I can obtain a routine for converting:

1). Dates to/from julian representations
2). Date/time values to/from Julian representations

Jul 13 '06 #1
4 4093
How may I represent dates as Julian dates - I have seen code where julian
dates are represented as longs, and other where they are represented as
floats. Which is the correct representation?

Anyone knows where I can obtain a routine for converting:

1). Dates to/from julian representations
2). Date/time values to/from Julian representations
I don't think there is a direct way, but see the various properties of
DateTime and TimeSpan. I think you can build it.

DateTime.DayOfY ear to get the daynumber.
With a timespan (DateTime.Now - DateTime.Today) you can also get the
TotalMinutes (or smaller).

You can use AddDays to add any number of days to a given date.

Hans Kesting
Jul 13 '06 #2
mac
I am a complete C# newbie, so I may be misunderstandin g Hans' post, but I
wanted to point out something:

A Julian date is actually the number of days (and fractional days) since
noon Jan. 1, 4713 BC.

Many people in the I.T. community for some reason call a date "Julian" when
it simply counts the number of days from the beginning of the year. For
instance, 7/13/2006 is sometimes represented in systems that lack a date
datatype as 2006193 (the 193rd day of 2006) I do not know the proper term
for this representation of a date, but it isn't a Julian date. I think
Han's method is geard toward this later representation.

Thanks,

Mac

"Hans Kesting" <ne***********@ spamgourmet.com wrote in message
news:mn******** *************** @spamgourmet.co m...
>How may I represent dates as Julian dates - I have seen code where julian
dates are represented as longs, and other where they are represented as
floats. Which is the correct representation?

Anyone knows where I can obtain a routine for converting:

1). Dates to/from julian representations
2). Date/time values to/from Julian representations

I don't think there is a direct way, but see the various properties of
DateTime and TimeSpan. I think you can build it.

DateTime.DayOfY ear to get the daynumber.
With a timespan (DateTime.Now - DateTime.Today) you can also get the
TotalMinutes (or smaller).

You can use AddDays to add any number of days to a given date.

Hans Kesting


Jul 14 '06 #3
Bit byte wrote:
How may I represent dates as Julian dates - I have seen code where
julian dates are represented as longs, and other where they are
represented as floats. Which is the correct representation?

Anyone knows where I can obtain a routine for converting:

1). Dates to/from julian representations
2). Date/time values to/from Julian representations
the routine is basicly this:

long DateToJulian(in t y, int m, int d)
{
return (1461 * (y + 4800 + (m - 14) / 12)) / 4 +
(367 * (m - 2 - 12 * ((m - 14) / 12))) / 12 -
(3 * ((y + 4900 + (m - 14) / 12) / 100)) / 4 +
d - 32075;
}

I found it on the web some time ago. Needed it in a lowlevel C app
once. In .NET you don't really need it, as DateTime has all you need :)

FB

--
------------------------------------------------------------------------
Lead developer of LLBLGen Pro, the productive O/R mapper for .NET
LLBLGen Pro website: http://www.llblgen.com
My .NET blog: http://weblogs.asp.net/fbouma
Microsoft MVP (C#)
------------------------------------------------------------------------
Jul 14 '06 #4
See http://www.vsg.cape.com/~pbaum/date/back.htm
mac wrote:
I am a complete C# newbie, so I may be misunderstandin g Hans' post, but I
wanted to point out something:

A Julian date is actually the number of days (and fractional days) since
noon Jan. 1, 4713 BC.

Many people in the I.T. community for some reason call a date "Julian" when
it simply counts the number of days from the beginning of the year. For
instance, 7/13/2006 is sometimes represented in systems that lack a date
datatype as 2006193 (the 193rd day of 2006) I do not know the proper term
for this representation of a date, but it isn't a Julian date. I think
Han's method is geard toward this later representation.

Thanks,

Mac

"Hans Kesting" <ne***********@ spamgourmet.com wrote in message
news:mn******** *************** @spamgourmet.co m...
>>>How may I represent dates as Julian dates - I have seen code where julian
dates are represented as longs, and other where they are represented as
floats. Which is the correct representation?

Anyone knows where I can obtain a routine for converting:

1). Dates to/from julian representations
2). Date/time values to/from Julian representations

I don't think there is a direct way, but see the various properties of
DateTime and TimeSpan. I think you can build it.

DateTime.DayO fYear to get the daynumber.
With a timespan (DateTime.Now - DateTime.Today) you can also get the
TotalMinute s (or smaller).

You can use AddDays to add any number of days to a given date.

Hans Kesting



Jul 14 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
16318
by: goochey | last post by:
I'm trying to convert a Julian Date (Format "4365") into an actual calendar date in Visual Basic, can anyone help me out with this.
3
9705
by: sunny076 | last post by:
Hi, I am trying to convert from Julian to Gregorian data in C#. I was exploring teh JulianCalendar and Gregorian calendar classes but still not sure how I can do it. For example, the Julian date is 100033 and I know that it is 2/2/2000 in Gregorian. I would appreciate if anyone can help point me out.
9
3695
by: Reggie | last post by:
Hi and TIA! I have a field that I want to convert from Julian to a short date. I've tried several procedures, but can't come up with the right solution. What I'm trying to do is convert 4023 to 01/23/04. If you know of a solution or somewhere I can find the answer I would appreciate it. Thanks for your time! -- Reggie
11
7632
by: Karl O. Pinc | last post by:
Hi, What's the best way to obtain the Julian day from a postgresql date? PostgreSQL 7.3.4 on i386-redhat-linux-gnu, compiled by GCC i386-redhat-linux-gcc (GCC) 3.2.2 20030222 (Red Hat Linux 3.2.2-5) I'm doing some date arithmetic with 1 day intervals and want to, for example, round to the even Julian day. I suppose
1
2490
by: '~=_Slawek_=~' | last post by:
$DOW = (jddayofweek(unixtojd(mktime(1, 1, 1, $month, $day, $year)))+6)%7; $DOW= (jddayofweek(juliantojd($month, $day, $year))+6)%7; The results are supposed to be the same, but they are not. Whats wrong? Any clues?
2
3560
by: No Spam | last post by:
Dear Access 2003 Users, I have been given an Excel 2003 spreadsheet with thousands of records, and I need to bring it into Access 2003. Does anyone know an Access formula that can convert these dates to "normal" dates? These are some examples of the dates that were sent to us: 738220000 629420000
1
2658
by: simchajoy2000 | last post by:
Hi, I am reading some dates from an Excel worksheet in my VB.NET code and even though in Excel these dates appear in this format 3/18/04, it is read into my code as a number like this: 36903. I have been told this is a Julian date but the calculations I have found on the internet to handle the conversion gives me dates from 1938 - so either this isn't a Julian number or excel has it's own way of calculating it.
4
14909
by: IsdWeb | last post by:
Hello, I am a newbie to coding and need some help. I am trying to figure out why the following code is not producing the correct Julian date. Any suggestions? Also, I am trying to understand the syntax liek what does DateAdd mean? If anyone can offer some good tutorials it would be appreciated as well. Thanks in advance.
15
16140
by: toadmaster | last post by:
I am new to access and I am learning as I go along; I am attempting to convert Julian dates to regular dates "MM-DD-YY"; I have tried the code below in the Query screen under criteria. CDate(Format(((DateValue("01/01/"+LTrim(Str(1900+Int(/1000))))+-Int(/1000)*1000))-1,"mm-dd-yy")) Trouble is it's not bringing up any result; the database field it's been applied to is blank now? I am not even sure if I am going about it the right way
0
8498
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8418
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
8630
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8694
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7458
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5718
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4237
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2833
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2084
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.