EPOCH to real time?

hi all :confused:

i am wondering if there is a way to convert from EPOCH time to the standard tim, may be using a script or some thing else???????

thanks............................

#!/usr/bin/perl -w
die "Usage: $0 seconds\n" unless scalar @ARGV;
print scalar localtime(shift),"\n";

C example:

#include <time.h>
#include <stdio.h>

/******************************************************
*   to_real_date()
*   parms: sec  =epoch time
*          dest =string to store result
*          len  =len of string (# bytes) 
*   convert sec in epoch time to standard data & time        
*******************************************************/

char *to_real_date(char *dest, time_t sec, size_t len)
{
          /* %c format = std date and time */
	size_t result=strftime(dest,len,"%c",localtime(&sec));
	
	if(result==0)
	{
		*dest=0x0;
	}
	return dest; 
}

int main()
{
	char tmp[80]={0x0};
	
	printf("1111256774 seconds into the epoch = %s\n", to_real_date(tmp, 1111256774, 80));
	return 0;
}

It can also be done in perl, or on Linux using the date utility -- see info date

if on Solaris:

echo "0t${currentEpoch}=Y" | /usr/bin/adb

thans for all

but can i do it using shell scripting on AIX platform or i should use a programming language to do that????

I don't know any direct method for getting the answer in AIX and doing it in a shell script will be complicated. Use C or Perl as per jim and hitori's posts.