Date calculation
Moderators: chulett, rschirm, roy
Date calculation
How do we find the start & end date of next month or previous month.Is there any function to do that.
There is, but you should have done a search before that.
Last date of the previous month -
And First day of the previous month -
Here RUN_DT is in yyyy%mm%dd.
And its better to use a stage variable for Month and Year, so the calculatin for December and January can be taken care with If - Then - Else.
Last date of the previous month -
Code: Select all
DateFromDaysSince(-1, StringToDate(RUN_DT, "%yyyy%mm") : "%yyyy-%mm-%dd")
Code: Select all
StringToDate('01':MonthFromDate(RUN_DT,"yyyy%mm%dd")-1,YearFromDate(RUN_DT,"yyyy%mm%dd"))
And its better to use a stage variable for Month and Year, so the calculatin for December and January can be taken care with If - Then - Else.
Impossible doesn't mean 'it is not possible' actually means... 'NOBODY HAS DONE IT SO FAR'
Re: Date calculation
Yeah Kumar is right and the code is also correct. create a stage variable for date and then give the derivations.
Suriv
No one is perfect... that's why pencils have erasers
No one is perfect... that's why pencils have erasers