How to manipulate date?

Hi
can u pls help me out with this as
i am relatively new to unix.

I need to use 4 different types of dates in my shell script

  • first day of the last(previous) month
  • last day of the last(previous) month
  • first day of the current month
  • (sysdate-1) yesterday's date for the current month.
    in dd/mm/yyyy HH24:MI:SS format..

I need to use them in my shell script
I need to pass the above date variables to a sql script..

thnks in advance..

Please see link

Hi
I don't want to use a function...

thnks a lot..

Why not?

Please have a look at the link encrypted posted - there are many date manipulation techniques presented there.

Also; it might be worth posting your flavour of UNIX (uname -a), and which shell you're using (echo $SHELL; echo $0) so we can deduce what will be applicable to you - for example, using a system with GNU date installed gives the option of using the flexible -d option to date.

Cheers
ZB

Hi ZB,
I am using ksh...and i have checked the encrypted link...there are several functions used..which I don't want to use..

$ uname -a
SunOS crddbdevl 5.6 Generic_105181-39 sun4u sparc SUNW,Ultra-Enterprise

$ date
Wed Apr 6 03:19:46 EDT 2005

and its ksh for sure....

How do you think that you are going to be able to grab the time and date and manipulate it without calling unix functions. This must be a school assignment, that is the only reason that I can see that you wouldn't want to use already written functions.