Sponsored Content
Top Forums Shell Programming and Scripting Problem with timegm function in perl Post 302207133 by chriss_58 on Thursday 19th of June 2008 08:00:54 AM
Old 06-19-2008
Problem with timegm function in perl

Hello..

In my code i use the following function:

$epochTime = timegm($sec, $min, $hour, $day, $month, $year)

The problem is that when $day==31, i get the following error:

Day '31' out of range 1..30 at unrated_namp_program line 113

Any idea how to overcome this???

Thank you very much
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

PERL function problem

I have perl script as follow. ------------------------------------------------------------------------ #! /usr/bin/env perl use strict; sub printLines { print "Inside the function.............\n"; my (@file , $count , $key ) = $_; print $count , $ key ; #... (2 Replies)
Discussion started by: avadhani
2 Replies

2. UNIX for Dummies Questions & Answers

perl bless function

hi i am not getting what exactly bless function do in perl explanation in perldoc is not very clear i tried to search on google but i am getting confused or rather not getting at all. can anybody explain in short what it does in following example as well as in general ? sub new { my... (1 Reply)
Discussion started by: zedex
1 Replies

3. Homework & Coursework Questions

PERL split function

Hi... I have a question regarding the split function in PERL. I have a very huge csv file (more than 80 million records). I need to extract a particular position(eg : 50th position) of each line from the csv file. I tried using split function. But I realized split takes a very long time. Also... (0 Replies)
Discussion started by: castle
0 Replies

4. Shell Programming and Scripting

PERL split function

Hi... I have a question regarding the split function in PERL. I have a very huge csv file (more than 80 million records). I need to extract a particular position(eg : 50th position) of each line from the csv file. I tried using split function. But I realized split takes a very long time. Also... (1 Reply)
Discussion started by: castle
1 Replies

5. Shell Programming and Scripting

Join Function in PERL

Hi, Can any one please let me know, how to join the lines in a file, but based one a condition. There is a file, where few lines start with a date stamp. and few do not. I wanted to join the lines till I find a date stamp. If found date its should in a newline. Please help me. ... (5 Replies)
Discussion started by: thankful123
5 Replies

6. Shell Programming and Scripting

Identify function image magick problem - perl

Hi, I got some error when I try to write content from file store into array then for each word that separate by space use identify function to display image information.here is my code #!/usr/bin/perl -w open(FILE,'transfer_file_perl.txt') or die "$!"; my $line = <FILE>;#because it is one... (2 Replies)
Discussion started by: guidely
2 Replies

7. Shell Programming and Scripting

perl function enquery

Dear all, I find a perl script that contains the following codes. Does anybody know the meaning of codes highlight. ..... @field = parse_csv($file); chomp(@field); ........ ........ sub parse_csv { my $text = shift; my @new = (); push( @new, $+ ) while $text =~ m{... (9 Replies)
Discussion started by: eldonlck
9 Replies

8. Shell Programming and Scripting

Problem in passing date to external function from perl script.

my $sysdate = strftime('%Y-%m-%d', localtime ); biDeriveByDate('Table_Str',$sysdate,\@lIndx,\@lResVals) In a perl script, when I'm trying to pass $sysdate to some external function it's not working since $sysdate is passed as a string mentioned above but my function is expecting a date value... (1 Reply)
Discussion started by: Devesh5683
1 Replies

9. Shell Programming and Scripting

Problem of Perl's "join" function

$ perl -e '@f=("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa","1","911"); print join("\t",@f)."\n";' aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa ... (5 Replies)
Discussion started by: carloszhang
5 Replies

10. Shell Programming and Scripting

Converting shell to Perl I run into shell built in function trap and need alternative in Perl

I am working on converting shell to Perl script. In shell we have built in function trap Do you know alternative in Perl or actually we don't need it? Thanks for contribution (3 Replies)
Discussion started by: digioleg54
3 Replies
Time::JulianDay(3)					User Contributed Perl Documentation					Time::JulianDay(3)

NAME
Time::JulianDay -- Julian calendar manipulations SYNOPSIS
use Time::JulianDay $jd = julian_day($year, $month_1_to_12, $day) $jd = local_julian_day($seconds_since_1970); $jd = gm_julian_day($seconds_since_1970); ($year, $month_1_to_12, $day) = inverse_julian_day($jd) $dow = day_of_week($jd) print (Sun,Mon,Tue,Wed,Thu,Fri,Sat)[$dow]; $seconds_since_jan_1_1970 = jd_secondslocal($jd, $hour, $min, $sec) $seconds_since_jan_1_1970 = jd_secondsgm($jd, $hour, $min, $sec) $seconds_since_jan_1_1970 = jd_timelocal($sec,$min,$hours,$mday,$month_0_to_11,$year) $seconds_since_jan_1_1970 = jd_timegm($sec,$min,$hours,$mday,$month_0_to_11,$year) DESCRIPTION
JulianDay is a package that manipulates dates as number of days since some time a long time ago. It's easy to add and subtract time using julian days... The day_of_week returned by day_of_week() is 0 for Sunday, and 6 for Saturday and everything else is in between. ERRATA
Time::JulianDay is not a correct implementation. There are two problems. The first problem is that Time::JulianDay only works with integers. Julian Day can be fractional to represent time within a day. If you call inverse_julian_day() with a non-integer time, it will often give you an incorrect result. The second problem is that Julian Days start at noon rather than midnight. The julian_day() function returns results that are too large by 0.5. What to do about these problems is currently open for debate. I'm tempted to leave the current functions alone and add a second set with more accurate behavior. There is another implementation in Astro::Time that may be more accurate. GENESIS
Written by David Muir Sharnoff <muir@idiom.com> with help from previous work by Kurt Jaeger aka PI <zrzr0111@helpdesk.rus.uni-stuttgart.de> based on postings from: Ian Miller <ian_m@cix.compulink.co.uk>; Gary Puckering <garyp%cognos.uucp@uunet.uu.net> based on Collected Algorithms of the ACM ?; and the unknown-to-me author of Time::Local. LICENSE
Copyright (C) 1996-1999 David Muir Sharnoff. License hereby granted for anyone to use, modify or redistribute this module at their own risk. Please feed useful changes back to muir@idiom.com. perl v5.12.1 2004-02-08 Time::JulianDay(3)
All times are GMT -4. The time now is 05:26 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy