Without knowing what your input file exactly looks like, I can only guess that the problem is that you've got "invalid" time values in there that you might want to filter out or fix when converting.

localtime() is taking starttime as a string & converting it to a default date

Yes, that is what localtime does. What is the problem?

You still haven't shown us: a representative sample of your input (i.e. a properly formatted copy-paste of the input file including those lines that cause the problem), your exact expected output; also your posts still aren't formatted properly.

Please take the time to read, understand and follow How do I post a question effectively? - help us to help you and you will find your questions can be answered much better and faster.


In reply to Re^4: localtime function by Anonymous Monk
in thread localtime function by rsodhia

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.