I need to convert a calendar date parameter (example 11/12/2012) to a 5 digit julian date (example 12317). The 5 digit julian is how I will access my data. Any ideas to how to do this?
\\{@JDate}
stringvar yr := RIGHT(totext(year({YourTable.YourDate}),0),2);
stringvar dy := totext(DateDiff('d',Date(year({YourTable.YourDate}),1,1),currentdate),0);
yr&dy
it will return the last 2 digits of the year and the number of days between the 1st of January and today's date.
hopefully i don't have any syntax or logic errors, if i do, my apologies in advance.
If you add the line below to the formula i provided then it will return a number.
IF isnumeric(yr) and isnumeric(dy) then tonumber(yr&dy) else 0
I was thinking a bit more about it and if the value entered by the parameter is not within the current year, there could be problems with the formula i provided. i have not tested this, but it is a thought to consider.
For that reason, Ian's may be a better solution, and his also returns a number without any sort of additional effort.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.