473,385 Members | 1,347 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Date convert to Julian

I need help in converting a normal date to Julian. Can
someone help me please.

Thanks

G
Nov 15 '05 #1
1 15451
public class Converter
{
private static string ToCalendar (DateTime old,Calendar cal)
{
StringBuilder bob = new StringBuilder ();

DateTime newForm = new DateTime (cal.GetYear (old),
cal.GetMonth (old),cal.GetDayOfMonth (old));

bob.Append (cal.GetDayOfWeek (old)).Append (" ")
.Append (newForm.ToLongDateString ());

return bob.ToString ();
}

public static string GregorianToJulian (DateTime greg)
{
return ToCalendar (greg,new JulianCalendar ());
}

public static string JulianToGregorian (DateTime jul)
{
return ToCalendar (new DateTime
(jul.Year,jul.Month,jul.Day,new JulianCalendar ()),
new GregorianCalendar ());
}
}

Purely out of curiosity, what's it for?

Regards,

Jasper Kent

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 15 '05 #2

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

Similar topics

5
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.
1
by: Islam Elkhayat | last post by:
In my C# Webapplication.. I enter the date in a textbox using popup Calender in the format MM/dd/yyyy.. when i retrieve date from Sql server for updating using datarow to fill the textbox the...
1
by: Raja | last post by:
Hi Anyone has any idea of how to convert Julian Date (eg. 12744057862..) to a VB.NET date time. Thanks in advance.
1
by: Sam | last post by:
How do I convert Julian Date to Calendar Date in ASP.Net 1.1 based on following guideline found at Internet? To convert Julian date to Gregorian date: double JD = 2299160.5; double Z =...
2
by: Rajat | last post by:
Hi, I have to draw a real time chart in which I have several entries at the same second (i.e. HH:MM:SS:Milleconds) The charting component only takes julian date for drawing the dates. I am...
14
by: pdavis06 | last post by:
I know that there is a thread about this, but I was unable to add to it; I just joined. The problem is that I do not want to change the date format for the entire database output, merely for a header...
4
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...
15
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. ...
1
by: smdmca | last post by:
I have Julian date, I want to convert it into date. Is there any function in MySql to convert Julian date to date eg- Julian Date- 2455116 Date - Oct - 12, 2009
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

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.