No of days

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

Post Reply
pradeep_nov18
Participant
Posts: 92
Joined: Wed Mar 05, 2008 4:09 am
Location: chennai
Contact:

No of days

Post by pradeep_nov18 »

Hoew derive the no of days from starting of the year to current date in datastage.

Please help on this.

Thanks,
pradeep.v
anbu
Premium Member
Premium Member
Posts: 596
Joined: Sat Feb 18, 2006 2:25 am
Location: india

Post by anbu »

Code: Select all

DaysSinceFromDate(TimestampToString(CurrentTimestamp(),"%yyyy-%mm-%dd"),TimestampToString(CurrentTimestamp(),"%yyyy"):'-01-01')
You are the creator of your destiny - Swami Vivekananda
pradeep_nov18
Participant
Posts: 92
Joined: Wed Mar 05, 2008 4:09 am
Location: chennai
Contact:

Post by pradeep_nov18 »

thx for your rply.

Let me analyze.
pradeep.v
pradeep_nov18
Participant
Posts: 92
Joined: Wed Mar 05, 2008 4:09 am
Location: chennai
Contact:

Post by pradeep_nov18 »

Hi anbu ,

bit confused ,

Suppose my batch date is 15-apr-2010 so i have calculate how manys days are there from 01-01-2010.how to achieve dis
pradeep.v
anbu
Premium Member
Premium Member
Posts: 596
Joined: Sat Feb 18, 2006 2:25 am
Location: india

Post by anbu »

Code: Select all

svMon=Upcase(Field(Inputdte,"-",2))
svMM=If svMon = 'JAN' Then '01' Else If svMon = 'FEB' Then '02' Else ..
svNewDt=Field(Inputdte,"-",3) : '-' : svMM : '-' Field(Inputdte,"-",1)
Convert your input date to yyyy-mm-dd and then use above function
You are the creator of your destiny - Swami Vivekananda
pradeep_nov18
Participant
Posts: 92
Joined: Wed Mar 05, 2008 4:09 am
Location: chennai
Contact:

Post by pradeep_nov18 »

anbu wrote:

Code: Select all

svMon=Upcase(Field(Inputdte,"-",2))
svMM=If svMon = 'JAN' Then '01' Else If svMon = 'FEB' Then '02' Else ..
svNewDt=Field(Inputdte,"-",3) : '-' : svMM : '-' Field(Inputdte,"-",1)
Convert your input date to yyyy-mm-dd and then use above function
i analysed your derivation.

It is working.

can you please let how to reterive total no of days in that month.

Thanks for your help.

Thanks much .
pradeep.v
Kryt0n
Participant
Posts: 584
Joined: Wed Jun 22, 2005 7:28 pm

Post by Kryt0n »

The date format yyyy-mmm-dd should be able to parse your input field - unless it is case sensitive but that would be silly!

That way you don't need to figure out what month it is
pradeep_nov18
Participant
Posts: 92
Joined: Wed Mar 05, 2008 4:09 am
Location: chennai
Contact:

Post by pradeep_nov18 »

Kryt0n wrote:The date format yyyy-mmm-dd should be able to parse your input field - unless it is case sensitive but that would be silly!

That way you don't need to figure out what month it is
Ya date format is same as above but i want to is any other function to achieve like eg:DaysSinceFromDate similar to daysfromthe month.

Thanks for the your inputs.
pradeep.v
Kryt0n
Participant
Posts: 584
Joined: Wed Jun 22, 2005 7:28 pm

Post by Kryt0n »

What is wrong with DaysSinceFromDate? Why would you need a different function if this achieves your aim?

If you are after something different then you will need to explain the problem more.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

I agree. DaysSinceFromDate() can answer both questions (since start of year and since start of month).
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Post Reply