I am trying to convert Julian date 116175 to calendar date in MM/DD/YYYY format in OBIEE 11g Analysis. Used below in Edit formula, but didn't work out.
cast("CycleCounts"."PJUPMJ" +1900000 as char)
Julian - 116175
Calendar Date - 6/23/2016
The result should really show as - 6/23/2016
Can anyone please help me?
Thanks!
Select Decode (Nvl (119031, 0), 0, To_Date (Null),To_Date (To_Char (119031 + 1900000) , 'YYYYDDD')) From Dual
where 119031 is your date value
Related
there is surprisingly little on the internet on converting a date that's in the Julian format YYYYDDD to YYYYMMDD. Does anyone know how to do it in PostgreSQL?
You can use to_date()
select to_date('2020123', 'yyyyddd')
Online example
Is there any function to convert Normal Date to Julian Date.
I have used JulianDayFromDate function in transformer but i am not getting expected output .
Sample Input :
Date -- 2013-02-02
Output Should be:
Julian Date-- 113033
( In Database we can do the query as below )
select to_date(1900000+113033,'YYYYDDD') from dual
But how to convert in Datastage ... ?
Maybe your expectations are wrong -
2456326 is the julian day for 2013-02-02 - the DataStage functions works.
Check out the Wikipedia documentation for defintions and calculations
Not sure what your 113033 is but it is not the Julian date or Julian day for the date shown.
To achieve what you want you have to do the calculation by your own.
Besides the year calcuation you could use YeardayFromDate to get the daynumer in the year.
So finally it would be something like
YearFromDate('2013-02-02') * 1000 - 1900000 + YeardayFromDate('2013-02-02')
Databases use different "day zero" values for Julian dates. Doesn't matter. The point is the ability to do date (day) arithmetic with them.
To convert back, use DateFromJulianDay() function.
I use a program that uses Fast Report in reporting the problem is that fast Report converts Hijri date to Gregorian date , although the settings of Windows is the Hijri date
Check out these links may be helpful
Cannot convert from Hijri Date to Gregorian date (c#)
https://social.msdn.microsoft.com/forums/vstudio/en-US/f2e7ec6a-a76a-4229-97d1-8505094a2657/wrong-date-in-converting-gregorian-to-hijri-calendar
http://www.islamicfinder.org/dateConversion.php
I have a Date field (CHAR Datatype) which has values in this format: YYYYMMDD.
For example 20140729.
I want to convert it into a Weeknumber in format YYYYWKNO
For example, the result would be 201432.
How this can be done in IBM DB2?
Luckily for you, DB2 has some pretty good date formatting functions. Although the links for the documentation are for DB2 for Linux/Unix/Windows, it will also work on DB2 for z/OS.
You can use TIMESTAMP_FORMAT() to convert your CHAR field to an actual date, which you can then use VARCHAR_FORMAT() to format it in the way you wish:
SELECT
VARCHAR_FORMAT(
TIMESTAMP_FORMAT(
'20140801'
,'YYYYMMDD'
)
,'YYYYWW'
)
FROM SYSIBM.SYSDUMMY1
There are two different formats for "week", one is WW, which will give the week based on a week beginning with January 1 and ending January 7, and IW, which will give the ISO Week.. Please see the documentation page for VARCHAR_FORMAT for the other formats available.
The following gets week 31 instead of 32. But overall I think it is a good solution for this problem:
SELECT TO_DATE('20140801', 'YYYYMMDD') AS MYDATE
, YEAR(TO_DATE('20140801', 'YYYYMMDD')) * 100 + WEEK(TO_DATE('20140801', 'YYYYMMDD')) AS YYYYWKNO
FROM SYSIBM.SYSDUMMY1
I'm new to Crystal Reports, I'm trying to extract and display month and year from the string (In DB the data type of the column is varchar). Following is an example of the data.
05-JAN-12 11.49.28.000000000 AM
I need it in following format
Jan-12
I have used cDate to convert the string to date format but was unsuccessful, maybe I didn't do it right way.
Alter the formula to extract the date portion, then convert it to a date:
DateValue(Split("05-JAN-12 11.49.28.000000000 AM")[1])
Apply formatting to the field as desired.
This may work
Date (Year ({reportfield}) * 10000 + Month ({reportfield}) * 100 + Day ({reportfield}))
Then format the field to display the date as your choosing.
MonthName(DatePart ("m", <<Date field>>))+"-"+totext(DatePart ("yyyy", <<DAtefield>>),0,"")