Wow. Your indenting is all over the place. Not to mention that the comment on the get_date sub is inaccurate and therefore misleading. But minor quibbles aside, I'd suggest using <code> tags to enclose code blocks. Your code looks odd because of things that appear to be $_0 which isn't valid. It looks like you meant $_[0], though. Oh, and @_[0] should probably be $_[0] anyway.

Anyway, that's all extraneous info. I ran your script snipppet through perl with the -wc switch. There was a warning about $hours in the date_to_unix sub. Your split is also not working properly.

I added the line die "Mon: $mon\nDay: $day\nYear: $year\nHour: $hour\nMin: $min\nSec: $sec\n"; after the split and got the following output when calling date_to_unix with the string "09/23/2003 14:30":

Mon: 09 Day: 23 Year: 2003 14:30 Hour: 09/23/2003 14 Min: 30 Sec:

So there's some direction, but no discrete answers. I leave it as an exercise to the reader to fill in the holes.

Update: The comment about using code tags has been taken care of. So that part of my note is obviously not relevant any more. :)


In reply to Re: date time to unix by Nkuvu
in thread date time to unix by britney

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.