Re: Extract string of form YYYYMMWW fro timestamp

2008-01-24 Thread Gunnar Hjalmarsson
Ow Mun Heng wrote: I'm wondering there's a simpler was to achieve this w/o need to jump through a couple of hoops. (meaning, concatenate the fields together from extract or some other method) Timestamp : '2008-01-17 10:24:00' Output needed : 20080103 or even 200801w3 use POSIX; use Dat

Re: Extract string of form YYYYMMWW fro timestamp

2008-01-23 Thread yitzle
http://perldoc.perl.org/perlfaq4.html#How-do-I-find-the-day-or-week-of-the-year%3F You can extract the -MM-DD with a simple RegEx (untested code): $str = q/Timestamp : '2008-01-17 10:24:00'/; my ($year, $mon, $day) = ($str =~ /\'([0-9]{4})-([0-9]{2})-([0-9]{2})/); -- To unsubscribe, e-mail:

Extract string of form YYYYMMWW fro timestamp

2008-01-23 Thread Ow Mun Heng
I'm wondering there's a simpler was to achieve this w/o need to jump through a couple of hoops. (meaning, concatenate the fields together from extract or some other method) Timestamp : '2008-01-17 10:24:00' Output needed : 20080103 or even 200801w3 In postgresql, this is done via select to_char