Substraction of month from the date
Moderators: chulett, rschirm, roy
Substraction of month from the date
hi,
could you please help me to find is there any function to substarct months from a given date.
i need to filter the records from the source data on a date column , if the 1st day of the previous month's date is friday then add 7 days to the particular date, filter those records which are not greater than the resultant date.
eg: 01-02-2008 is friday and i need to filter the records which are not greater than 08-02-2008. but my jobs are running in march.
Appreciate your help on this.
could you please help me to find is there any function to substarct months from a given date.
i need to filter the records from the source data on a date column , if the 1st day of the previous month's date is friday then add 7 days to the particular date, filter those records which are not greater than the resultant date.
eg: 01-02-2008 is friday and i need to filter the records which are not greater than 08-02-2008. but my jobs are running in march.
Appreciate your help on this.
Thanks and Regards,
Sivasankar.z
+44-07807478984
Sivasankar.z
+44-07807478984
This is one of the recent discussion about adding month, manipulate it.
viewtopic.php?t=118119&highlight=month
You can search for more different methodologies. But your post seems to be more focusing on adding 7 days of data to it??
viewtopic.php?t=118119&highlight=month
You can search for more different methodologies. But your post seems to be more focusing on adding 7 days of data to it??
Impossible doesn't mean 'it is not possible' actually means... 'NOBODY HAS DONE IT SO FAR'
the logic should be ,whenever the first of the previous month falls on friday only i need to filter the records.
but how can i find the first of the previous month is friday?
for example if my job runs on today 21-04-08 then i need to check the first of the previous month 01-03-08 is friday or not .
appreciate your help to find out.
but how can i find the first of the previous month is friday?
for example if my job runs on today 21-04-08 then i need to check the first of the previous month 01-03-08 is friday or not .
appreciate your help to find out.
Thanks and Regards,
Sivasankar.z
+44-07807478984
Sivasankar.z
+44-07807478984
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
Code: Select all
date +%Y" "%m | perl -ane ' use Time::Local; $wday = (localtime(timelocal(0,0,0,1,$F[1]-2,$F[0]-1900)))[6]; print $wday; '
I think a solution for this.
Take the year and month from the CurrentDate().
The date required is yyyy : (mm-1)only the value range between 02 and 12 : 01 . Use StringToDate function.
Then use the function WeekdayFromDate(1st of thePrevious Month Date) if it returns 5 then it is friday which i am looking for.
But it needs to test for my requirement.
Take the year and month from the CurrentDate().
The date required is yyyy : (mm-1)only the value range between 02 and 12 : 01 . Use StringToDate function.
Then use the function WeekdayFromDate(1st of thePrevious Month Date) if it returns 5 then it is friday which i am looking for.
But it needs to test for my requirement.
Thanks and Regards,
Sivasankar.z
+44-07807478984
Sivasankar.z
+44-07807478984