[an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive]
 
[an error occurred while processing this directive] [an error occurred while processing this directive]
Skåne Sjælland Linux User Group - http://www.sslug.dk Home   Subscribe   Mail Archive   Forum   Calendar   Search
MhonArc Date: [Date Prev] [Date Index] [Date Next]   Thread: [Date Prev] [Thread Index] [Date Next]   MhonArc
 

DATETIME fra perl



HP Openview bruger et tidsformat der ser sådan ud:

Thu Mar  9 08:49:01 2000

Jeg skal have disse lagt ind i en MySQL database som DATETIME, men jeg kan ikke
rigtigt få konverteret på en smart måde. Jeg har lavet et workaround med date
på en linux dåse, men det er altså ikke særlig portabelt, og det ser heller
ikke særligt pænt ud.

Det jeg altså gerne vil have perl til er at lave nedenstående (lidt smartere):

------

#!/usr/bin/perl

$timeStamp="Thu Mar  9 08:49:01 2000";
$DATETIME=`date -d "$timeStamp" +"%Y-%m-%d %T"`;
print $DATETIME;

------

sslug@sslug perl]$ ./timetest.pl 
2000-03-09 08:49:01

-- 
Most kind regards,
Kristian Bjoernskov, <mailto:sslug@sslug>
Novo Nordisk IT, Network - internet.
Phone: +45 4442 3299. Fax: +45 4442 6061


 
Home   Subscribe   Mail Archive   Index   Calendar   Search

 
 
Questions about the web-pages to <www_admin>. Last modified 2005-08-10, 19:52 CEST [an error occurred while processing this directive]
This page is maintained by [an error occurred while processing this directive]MHonArc [an error occurred while processing this directive] # [an error occurred while processing this directive] *