Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Convert EPOCH timestamp

Status
Not open for further replies.

albertman

MIS
May 6, 2001
8
AU
Is there a way to convert EPOCH timestamp to normal text format with shell script or command ?

Say I want to convert a file name "au_sydn0-all_1017651655_FULL" to "au_sydn0-all-13 March 2002 10:00 _FULL".

I know I can do this by using perl, but is there an utilty in UNIX or DOS performs this ?
 
i had compile a c program to do this

#include <stdio.h>
#include <time.h>
main(int argc,char *argv[] ){
time_t seconds;
struct tm *tmGMTp;
if(argc==2)
seconds=atol(argv[1]);
else
{
fprintf(stderr,&quot;usage: %s seconds - convert seconds to date\n&quot;,
argv [0]);
exit(1);
}
if ( (tmGMTp=gmtime(&seconds)) != 0 ) {
printf(&quot;%s&quot;, ctime(&seconds));
return(0); }
else {
return (1); }
}

by

#gcc s2d.c –o s2d
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top