Thank you very much for responding.. I am trying to teach myself Crystal Reports and this was one of the road blocks that i ran into... As side from dropping the { } do you know what else i would need to change to get that to work in a formula??
My goal is to show 6 months of data so in the code below i was able to show the start and end date for each month but trying to conver that start and end into julian start and end is what i having a hard time with
BeforeReadingRecords;
Local dateVar back2;
Local dateVar back2start;
back2 := CDate(DateAdd("m",-6,CurrentDate));
back2start := Date(Year(back2),Month(back2),01);
back2start
END
BeforeReadingRecords;
Local dateVar back2;
Local dateVar back2end;
back2 := CDate(DateAdd("m",-5,CurrentDate));
back2end := CDate(DateAdd("d",-1,Date(Year(back2),Month(back2),01)));
back2end
So if i get you right then in your database the dates are stored in julian format, right? thats why you are converting the dates in Julian and pulling the data.
TheEisdame
Member
9 Points
119 Posts
Julian Date Question
Jan 18, 2013 01:42 PM|LINK
Hello world! I am praying that someone can help me understand how to convert the code below to julian date
Have created a start and end
here is the start:
BeforeReadingRecords;
Local dateVar back2;
Local dateVar back2start;
back2 := CDate(DateAdd("m",-6,CurrentDate));
back2start := Date(Year(back2),Month(back2),01);
back2start
END
BeforeReadingRecords;
Local dateVar back2;
Local dateVar back2end;
back2 := CDate(DateAdd("m",-5,CurrentDate));
back2end := CDate(DateAdd("d",-1,Date(Year(back2),Month(back2),01)));
back2end
GaurangNaik
Contributor
2070 Points
497 Posts
Re: Julian Date Question
Jan 18, 2013 01:49 PM|LINK
Hi,
Exactly one year ago, I was searching the same. Here is method to do it.
public long Date2Julian(System.DateTime vDate) { return Convert.ToInt64(Strings.Format(DateAndTime.Year(vDate), "0000") + Strings.Format(DateAndTime.DateDiff("d", Convert.ToDateTime("01/01/" + Strings.Format(DateAndTime.Year(vDate), "0000")), vDate) + 1, "000")); }You can comapre your results with this site:
http://aa.usno.navy.mil/data/docs/JulianDate.php
Hope it helps !
Please mark as ANSWER if it helped you.
GauranG
TheEisdame
Member
9 Points
119 Posts
Re: Julian Date Question
Jan 18, 2013 02:01 PM|LINK
Thank you very much for responding.. I am trying to teach myself Crystal Reports and this was one of the road blocks that i ran into... As side from dropping the { } do you know what else i would need to change to get that to work in a formula??
GaurangNaik
Contributor
2070 Points
497 Posts
Re: Julian Date Question
Jan 18, 2013 02:09 PM|LINK
Well, You will have to give me more details about what exactly you are trying to achieve. and how are you designing the report.
GauranG
TheEisdame
Member
9 Points
119 Posts
Re: Julian Date Question
Jan 18, 2013 02:16 PM|LINK
My goal is to show 6 months of data so in the code below i was able to show the start and end date for each month but trying to conver that start and end into julian start and end is what i having a hard time with
BeforeReadingRecords;
Local dateVar back2;
Local dateVar back2start;
back2 := CDate(DateAdd("m",-6,CurrentDate));
back2start := Date(Year(back2),Month(back2),01);
back2start
END
BeforeReadingRecords;
Local dateVar back2;
Local dateVar back2end;
back2 := CDate(DateAdd("m",-5,CurrentDate));
back2end := CDate(DateAdd("d",-1,Date(Year(back2),Month(back2),01)));
back2end
GaurangNaik
Contributor
2070 Points
497 Posts
Re: Julian Date Question
Jan 18, 2013 02:51 PM|LINK
So if i get you right then in your database the dates are stored in julian format, right? thats why you are converting the dates in Julian and pulling the data.
GauranG
TheEisdame
Member
9 Points
119 Posts
Re: Julian Date Question
Jan 18, 2013 02:55 PM|LINK
yes that is correct