Re: [rt-users] Day of the week
Thank you everybody for your help. This: my $dayOfWeek = POSIX::strftime ("%A", localtime ); $RT::Logger->debug("Day of Week is : $dayOfWeek "); works fine. I had a stupid error there, Tom. Micah Gersten napsal(a): > This might be what you're looking for: > http://search.cpan.org/~stbey/Date-Calc-5.4/Calc.pod > > Thank you, > Micah Gersten > onShore Networks > Internal Developer > http://www.onshore.com > > > > Tomáš Sára wrote: > >> Hello everybody, >> >> is there a possibility to find out the day of the week out of the date? >> I sopose there should be a perl function for this. Am I right? I >> searched mailing lists but I didn't find any information there. >> >> Thanks in advance for any help, >> Tom. >> >> > > ___ http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users Community help: http://wiki.bestpractical.com Commercial support: sa...@bestpractical.com Discover RT's hidden secrets with RT Essentials from O'Reilly Media. Buy a copy at http://rtbook.bestpractical.com
Re: [rt-users] Day of the week
This might be what you're looking for: http://search.cpan.org/~stbey/Date-Calc-5.4/Calc.pod Thank you, Micah Gersten onShore Networks Internal Developer http://www.onshore.com Tomáš Sára wrote: > Hello everybody, > > is there a possibility to find out the day of the week out of the date? > I sopose there should be a perl function for this. Am I right? I > searched mailing lists but I didn't find any information there. > > Thanks in advance for any help, > Tom. > ___ http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users Community help: http://wiki.bestpractical.com Commercial support: sa...@bestpractical.com Discover RT's hidden secrets with RT Essentials from O'Reilly Media. Buy a copy at http://rtbook.bestpractical.com
Re: [rt-users] Day of the week
Tomáš Sára wrote: This shows no errors but instead of writing the day of the week into log file it writes "0". I'm not sure what "localtime" is. Is it the variable containing the local time? Something like: my $localtime = my $now = RT::Date->new($RT::SystemUser); $now->SetToNow; Or should I write there just "localhost"? None of this seem to work. localtime() is a standard perl function that returns the time according to the local timezone broken down into an array of fields: sec, min, hour, day etc. See: 'perldoc -f localtime' for the full story. There's also gmtime() which produces the UTC time in the same format. Either of those two functions takes an optional argument which is a timestamp expressed as 'seconds since the epoch' a.k.a. unix time -- without an argument they default to the current time. If you just want to get a timestamp on your log records, then there's potentially a much simpler method you could use. Instead of logging to a file, just use the Unix syslog instead: that will automatically tag each line with a timestamp. Something like: Set($LogToSyslog, 'debug'); (although this seems to be the default already). Cheers, Matthew -- Dr Matthew SeamanThe Bunker, Ash Radar Station PGP: 0x60AE908C on servers Marshborough Rd Tel: +44 1304 814890 Sandwich Fax: +44 1304 814899 Kent, CT13 0PL, UK signature.asc Description: OpenPGP digital signature ___ http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users Community help: http://wiki.bestpractical.com Commercial support: sa...@bestpractical.com Discover RT's hidden secrets with RT Essentials from O'Reilly Media. Buy a copy at http://rtbook.bestpractical.com
Re: [rt-users] Day of the week
This shows no errors but instead of writing the day of the week into log file it writes "0". I'm not sure what "localtime" is. Is it the variable containing the local time? Something like: my $localtime = my $now = RT::Date->new($RT::SystemUser); $now->SetToNow; Or should I write there just "localhost"? None of this seem to work. Do you have any ideas what to do? Thank a lot, Tom. Marouane Himdi napsal(a): > Sorry > my $dayOfWeek = POSIX::strftime ("%A", localtime ); > $RT::Logger->debug("Day of Week is : $dayOfWeek "); > > Works for me > > > Dr Marouane HIMDI > > > - Mail Original - > De: "Tomáš Sára" > À: rt-users@lists.bestpractical.com > Envoyé: Vendredi 16 Janvier 2009 14h23:05 GMT +01:00 Amsterdam / Berlin / > Berne / Rome / Stockholm / Vienne > Objet: Re: [rt-users] Day of the week > > Unfortunatelly even this does not work. I got this error "Scrip 83 > Commit failed: syntax error at (eval 2172) line 26, near "strftime "%A"" > (/opt/rt3/bin/../lib/RT/Action/UserDefined.pm:80). > > Any suggestions. > > Thanks, Tom. > > Marouane Himdi napsal(a): > >> i think this should work >> >> my $dayOfWeek = strftime "%A", localtime; >> >> >> >> Dr Marouane HIMDI >> >> >> ----- Mail Original - >> De: "Tomáš Sára" >> À: "Matthew Seaman" >> Cc: rt-users@lists.bestpractical.com >> Envoyé: Vendredi 16 Janvier 2009 11h56:30 GMT +01:00 Amsterdam / >> Berlin / Berne / Rome / Stockholm / Vienne >> Objet: Re: [rt-users] Day of the week >> >> Thanks for your answer. What you wrote works fine in shell. I need to >> do this in scrip. Is there any possibility? >> >> Thanks a lot for any comments, >> Tom. >> >> Matthew Seaman napsal(a): >> >>> Tomáš Sára wrote: >>> >>>> Hello everybody, >>>> >>>> is there a possibility to find out the day of the week out of the >>>> date? I sopose there should be a perl function for this. Am I right? >>>> I searched mailing lists but I didn't find any information there. >>>> >>>> Thanks in advance for any help, >>>> >>> % perl -MPOSIX -le 'print strftime "%A", localtime;' >>> Friday >>> >>> Cheers, >>> >>> Matthew >>> >>> >> ___ >> http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users >> >> Community help: http://wiki.bestpractical.com >> Commercial support: sa...@bestpractical.com >> >> >> Discover RT's hidden secrets with RT Essentials from O'Reilly Media. >> Buy a copy at http://rtbook.bestpractical.com >> >> > > > ___ > http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users > > Community help: http://wiki.bestpractical.com > Commercial support: sa...@bestpractical.com > > > Discover RT's hidden secrets with RT Essentials from O'Reilly Media. > Buy a copy at http://rtbook.bestpractical.com > > ___ http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users Community help: http://wiki.bestpractical.com Commercial support: sa...@bestpractical.com Discover RT's hidden secrets with RT Essentials from O'Reilly Media. Buy a copy at http://rtbook.bestpractical.com
Re: [rt-users] Day of the week
Sorry my $dayOfWeek = POSIX::strftime ("%A", localtime ); $RT::Logger->debug("Day of Week is : $dayOfWeek "); Works for me Dr Marouane HIMDI - Mail Original - De: "Tomáš Sára" À: rt-users@lists.bestpractical.com Envoyé: Vendredi 16 Janvier 2009 14h23:05 GMT +01:00 Amsterdam / Berlin / Berne / Rome / Stockholm / Vienne Objet: Re: [rt-users] Day of the week Unfortunatelly even this does not work. I got this error "Scrip 83 Commit failed: syntax error at (eval 2172) line 26, near "strftime "%A"" (/opt/rt3/bin/../lib/RT/Action/UserDefined.pm:80). Any suggestions. Thanks, Tom. Marouane Himdi napsal(a): > i think this should work > > my $dayOfWeek = strftime "%A", localtime; > > > > Dr Marouane HIMDI > > > - Mail Original - > De: "Tomáš Sára" > À: "Matthew Seaman" > Cc: rt-users@lists.bestpractical.com > Envoyé: Vendredi 16 Janvier 2009 11h56:30 GMT +01:00 Amsterdam / > Berlin / Berne / Rome / Stockholm / Vienne > Objet: Re: [rt-users] Day of the week > > Thanks for your answer. What you wrote works fine in shell. I need to > do this in scrip. Is there any possibility? > > Thanks a lot for any comments, > Tom. > > Matthew Seaman napsal(a): >> Tomáš Sára wrote: >>> Hello everybody, >>> >>> is there a possibility to find out the day of the week out of the >>> date? I sopose there should be a perl function for this. Am I right? >>> I searched mailing lists but I didn't find any information there. >>> >>> Thanks in advance for any help, >> % perl -MPOSIX -le 'print strftime "%A", localtime;' >> Friday >> >> Cheers, >> >> Matthew >> > > ___ > http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users > > Community help: http://wiki.bestpractical.com > Commercial support: sa...@bestpractical.com > > > Discover RT's hidden secrets with RT Essentials from O'Reilly Media. > Buy a copy at http://rtbook.bestpractical.com > ___ http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users Community help: http://wiki.bestpractical.com Commercial support: sa...@bestpractical.com Discover RT's hidden secrets with RT Essentials from O'Reilly Media. Buy a copy at http://rtbook.bestpractical.com ___ http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users Community help: http://wiki.bestpractical.com Commercial support: sa...@bestpractical.com Discover RT's hidden secrets with RT Essentials from O'Reilly Media. Buy a copy at http://rtbook.bestpractical.com
Re: [rt-users] Day of the week
Unfortunatelly even this does not work. I got this error "Scrip 83 Commit failed: syntax error at (eval 2172) line 26, near "strftime "%A"" (/opt/rt3/bin/../lib/RT/Action/UserDefined.pm:80). Any suggestions. Thanks, Tom. Marouane Himdi napsal(a): > i think this should work > > my $dayOfWeek = strftime "%A", localtime; > > > > Dr Marouane HIMDI > > > - Mail Original - > De: "Tomáš Sára" > À: "Matthew Seaman" > Cc: rt-users@lists.bestpractical.com > Envoyé: Vendredi 16 Janvier 2009 11h56:30 GMT +01:00 Amsterdam / > Berlin / Berne / Rome / Stockholm / Vienne > Objet: Re: [rt-users] Day of the week > > Thanks for your answer. What you wrote works fine in shell. I need to > do this in scrip. Is there any possibility? > > Thanks a lot for any comments, > Tom. > > Matthew Seaman napsal(a): >> Tomáš Sára wrote: >>> Hello everybody, >>> >>> is there a possibility to find out the day of the week out of the >>> date? I sopose there should be a perl function for this. Am I right? >>> I searched mailing lists but I didn't find any information there. >>> >>> Thanks in advance for any help, >> % perl -MPOSIX -le 'print strftime "%A", localtime;' >> Friday >> >> Cheers, >> >> Matthew >> > > ___ > http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users > > Community help: http://wiki.bestpractical.com > Commercial support: sa...@bestpractical.com > > > Discover RT's hidden secrets with RT Essentials from O'Reilly Media. > Buy a copy at http://rtbook.bestpractical.com > ___ http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users Community help: http://wiki.bestpractical.com Commercial support: sa...@bestpractical.com Discover RT's hidden secrets with RT Essentials from O'Reilly Media. Buy a copy at http://rtbook.bestpractical.com
Re: [rt-users] Day of the week
Thanks for your answer. What you wrote works fine in shell. I need to do this in scrip. Is there any possibility? Thanks a lot for any comments, Tom. Matthew Seaman napsal(a): > Tomáš Sára wrote: >> Hello everybody, >> >> is there a possibility to find out the day of the week out of the >> date? I sopose there should be a perl function for this. Am I right? >> I searched mailing lists but I didn't find any information there. >> >> Thanks in advance for any help, > > % perl -MPOSIX -le 'print strftime "%A", localtime;' > Friday > > Cheers, > > Matthew > ___ http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users Community help: http://wiki.bestpractical.com Commercial support: sa...@bestpractical.com Discover RT's hidden secrets with RT Essentials from O'Reilly Media. Buy a copy at http://rtbook.bestpractical.com
Re: [rt-users] Day of the week
Tomáš Sára wrote: Hello everybody, is there a possibility to find out the day of the week out of the date? I sopose there should be a perl function for this. Am I right? I searched mailing lists but I didn't find any information there. Thanks in advance for any help, % perl -MPOSIX -le 'print strftime "%A", localtime;' Friday Cheers, Matthew -- Dr Matthew SeamanThe Bunker, Ash Radar Station PGP: 0x60AE908C on servers Marshborough Rd Tel: +44 1304 814890 Sandwich Fax: +44 1304 814899 Kent, CT13 0PL, UK signature.asc Description: OpenPGP digital signature ___ http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users Community help: http://wiki.bestpractical.com Commercial support: sa...@bestpractical.com Discover RT's hidden secrets with RT Essentials from O'Reilly Media. Buy a copy at http://rtbook.bestpractical.com