If you don't want to shell out for this, or if you are not on UNIX, just use
the sprintf() function.

E.g. 
   sprintf("%02d",$month); 
   #should pad the left side with one zero 
   #if the number is less than 10.

In addition I believe that if you 'use POSIX', there is a strftime()
function that is similar to 'date' for UNIX, but I haven't used it.

-----Original Message-----
From: Dan Muey
To: John Dunn; [EMAIL PROTECTED]
Sent: 1/6/03 7:10 AM
Subject: RE: return date/time in required format

Print `date +%m`;
Prints '01' for january, '02' for February etc

You can format all kinds of time with this. 

Unix> man date

Dan

-----Original Message-----
From: John Dunn [mailto:[EMAIL PROTECTED]] 
Sent: Monday, January 06, 2003 8:58 AM
To: [EMAIL PROTECTED]
Subject: return date/time in required format


I need to return the current date and time in the following format

YYYYMMDDHHMMSS

but am struggling to do this using the localtime function

In perticular, how do I get the month number(e.g. 09 for Sep)?

John Dunn
Sefas Innovation Ltd
0117 9154267
www.sefas.com


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to