Regular Date To JulianDate
Moderators: chulett, rschirm, roy
Regular Date To JulianDate
I need to convert DataStage current Date (2009-05-13) to JulianDate
Example:
from source I am getting Date: 109096
i.e. 1900+109 =2009
096 = 0406 (April 06)
I am trying below but I couldn't get it...
Oconv(Iconv("2009-04-06","D4-YMD[4,2,2]"),"DJ")
FOR JulianDateToTimeStamp I am able to convert ...
OCONV(ICONV(%JulianDate% + 1900000, "D4-"), "D4-YMD[4,2,2]")
Please anybody can help?
Thanks in advance
Example:
from source I am getting Date: 109096
i.e. 1900+109 =2009
096 = 0406 (April 06)
I am trying below but I couldn't get it...
Oconv(Iconv("2009-04-06","D4-YMD[4,2,2]"),"DJ")
FOR JulianDateToTimeStamp I am able to convert ...
OCONV(ICONV(%JulianDate% + 1900000, "D4-"), "D4-YMD[4,2,2]")
Please anybody can help?
Thanks in advance
Thanks for reply.ArndW wrote:Can you break up the problem into 2 steps, first the ICONV and then the OCONV?
When you get "109096" what function do you use and do you convert it to a display date or a DataStage internal date? ...
I am able to converting
OCONV(ICONV("109096" + 1900000, "D4-"), "D4-YMD[4,2,2]")
I am passing my Column name which is "109096" and it displays Date = 2009-04-06
Now I need just reverse if I pass 2009-04-06 then I need "109096"
Have you tried the inverse function,
Code: Select all
OCONV(ICONV("2009-04-06","D4-YMD[4,2,2]")[b]-1900000[/b],"DJ")[code]
ArndW wrote:Have you tried the inverse function,Code: Select all
OCONV(ICONV("2009-04-06","D4-YMD[4,2,2]")[b]-1900000[/b],"DJ")[code] ...[/quote] Can you please elaborate ? what is [code] ?
Broken formatting tag, ignore it. Should have looked like this:
Code: Select all
OCONV(ICONV("2009-04-06","D4-YMD[4,2,2]") -1900000 ,"DJ")
-craig
"You can never have too many knives" -- Logan Nine Fingers
"You can never have too many knives" -- Logan Nine Fingers
ArndW wrote:Have you tried the inverse function,Code: Select all
OCONV(ICONV("2009-04-06","D4-YMD[4,2,2]")[b]-1900000[/b],"DJ")[code] ...[/quote] I tried this and got value "114", I never used inverse function,can you please tellme the how to use this [code]? Thaks
chulett wrote:Broken formatting tag, ignore it. Should have looked like this:
...Code: Select all
OCONV(ICONV("2009-04-06","D4-YMD[4,2,2]") -1900000 ,"DJ")
I tried this.I got value "114"
Thanks.ArndW wrote:I don't have access to DS or the manuals, but I kind of doubt your 1900000 addition/subtraction - that number looks wrong. Where did you get that and are you certain it works? ...
I am not sure about this 1900000 but is showing currect result
FOR JulianDateToDate I am able see currect result...
OCONV(ICONV("109096" + 1900000, "D4-"), "D4-YMD[4,2,2]")
result : 2009-04-06
Re: Reguler Date To JulianDate
Are you trying to convert a value from source or current date?lak4u wrote:I need to convert DataStage current Date (2009-05-13) to JulianDate
Example:
from source I am getting Date: 109096
i.e. 1900+109 =2009
096 = 0406 (April 06)
Assuming your source is always six characters, form your date (doing as you are doing), convert to internal format and add 2439856 (this being 31 December 1967 in Julian Date).
The OCONV format "DJ" gives Julian Year Date and not Julian Date that is why you get 114.
Re: Reguler Date To JulianDate
Also known as an "Ordinal" date - the day number of that year.Kryt0n wrote:The OCONV format "DJ" gives Julian Year Date and not Julian Date that is why you get 114.
-craig
"You can never have too many knives" -- Logan Nine Fingers
"You can never have too many knives" -- Logan Nine Fingers