Date format change in AIX

Hi I have a date format in a variable as Apr 7 03:35:59 EDT 2016 . how do i change it to 04/07/2016 03:35:59 EDT format

Hi,

You don't say how you source the variable, however you can try;

date '%m/%d/%y %H:%M:%S'

The information is in the man pages, use man date and you should find what you want.

Regards

Gull04

The format requested if the user is trying to format the current date and time is:

date '+%m/%d/%Y %H:%M:%S %Z'

(note the leading + required to specify that a format string follows, %Y instead of %y (complete year, not just the last two digits) and %Z (include the timezone name).

If the intent is to take an existing date and time in the first given format and convert it to the corresponding second given format, there is no way to guess at what year should be used for an arbitrary date and time from some point in the past.

Source of variable is taken from log file. So I need to format variable later. I am working in AIX . Not finding Gnu date

As Don said, there's no way to guess the year (unless you know the date is within a specific time window e.g. no more than 300 days in the past).

There are some date scripts in the FAQ and Tips forums.

I have missed 2016 in end