Page 1 of 1

Get the start date of the month

PostPosted: Tue Apr 24, 2012 12:47 pm
by jvinoth
How to get the month's start date by giving the current date..please tell me how to get this using the sort..

suppose if we give the particular date we need to get the that date's month starting date...
thank you so much.

Re: Get the start date of the month

PostPosted: Tue Apr 24, 2012 1:16 pm
by prino
Every month starts on the first, what's your problem?

Re: Get the start date of the month

PostPosted: Tue Apr 24, 2012 1:17 pm
by BillyBoyo
What format is your input date? Have you considered just setting the DD part of the date (if yours contains that) to '01'?

However, does it matter if that is a weekend/holiday?

Re: Get the start date of the month

PostPosted: Tue Apr 24, 2012 2:49 pm
by jvinoth
mm/dd/yy format and its k if its weekend or holiday.

Re: Get the start date of the month

PostPosted: Tue Apr 24, 2012 3:59 pm
by BillyBoyo
In mm/dd/yy, mm/01/yy is always the first day of the month.

  OVERLAY=(startpositionofday:C'01')


Would make the date the first of the month.

If you ever need the last day of the week, month, quarter or year, there are DFSORT functions for those. There are other DFSORT date functions, and it is worth familiarising yourself with them if you are doing date processing. There are further date manipulations in the Smart DFSORT Tricks book, available on the web.