![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Unix Arithmatic operation issue , datatype issue | thambi | Shell Programming and Scripting | 23 | 02-19-2008 07:19 AM |
| File timestamp issue on HP servers | siddaonline | UNIX for Advanced & Expert Users | 5 | 07-04-2007 11:09 AM |
| timestamp | Minguccio75 | SUN Solaris | 4 | 02-21-2007 04:06 AM |
| timestamp | rocker40 | UNIX for Dummies Questions & Answers | 3 | 10-09-2003 09:09 AM |
| ftp timestamp | Henrik | UNIX for Dummies Questions & Answers | 4 | 05-03-2003 09:19 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
Timestamp issue in perl script language
Hello all,
I have a problem with timestamps in perl. Suppose we have the following timestamp: Wed Oct 22 13:20:41 2008 This timestamp is produced with 'localtime' function. How can i convert the above timestamp to the format: 081022132041 08=2008 10=Oct Thank you... Last edited by chriss_58; 10-22-2008 at 07:42 AM.. |
|
||||
|
Do you want to do this from C - then look at the strftime function?
code snippet: Code:
char output[80]={0x0};
time_t lt=time(NULL);
char *fmt="%y%m%d%H%%M%S";
strftime(output, sizeof(output), fmt, localtime(<);
printf("%s\n", output);
|
|
||||
|
Code:
perl -e 'print strftime "%y%m%d%H%%M%S\n", localtime($mtime);' Code:
perl -e 'use POSIX qw(strftime);print strftime "%y%m%d%H%M%S\n", localtime();' 081022102542 |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|