MrCromeDome has asked for the wisdom of the Perl Monks concerning the following question:
I'm trying to split a date a couple of different ways. In one instance, I want only the date portion. In the other, I want the date and time, but not seconds, milliseconds, etc.
For example, my database gives me the following date, which I promptly assign to $doc_date:
Using the following code, I can get only the date portion:2001-05-17 14:40:00.123
However, if I change my code to:($date, $discard) = split(" ",$doc_date);
I know that I will only get the hour, not the hour and minutes. How can I change my code to give me the proper time (in this case, 14:40), but not the seconds or milliseconds?($date, $discard) = split(":",$doc_date);
Thanks!
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Date parsing
by Albannach (Monsignor) on May 17, 2001 at 23:55 UTC | |
Re: Date parsing
by sutch (Curate) on May 17, 2001 at 23:51 UTC | |
(tye)Re: Date parsing
by tye (Sage) on May 17, 2001 at 23:54 UTC | |
Re: Date parsing
by aijin (Monk) on May 17, 2001 at 23:52 UTC | |
Re: Date parsing
by malloc (Pilgrim) on May 17, 2001 at 23:53 UTC | |
Re: Date parsing
by BigJoe (Curate) on May 18, 2001 at 01:05 UTC |
Back to
Seekers of Perl Wisdom