Sponsored Content
Full Discussion: Time/date manipulation
Top Forums Programming Time/date manipulation Post 14546 by Perderabo on Friday 1st of February 2002 03:06:40 PM
Old 02-01-2002
Code:
      struct timeval tv;
      struct timezone tz;
      struct tm *tm;
      gettimeofday(&tv, &tz);
      tm=localtime(&tv.tv_sec);
      for(n=0; n<2; n++)
            if(!tm->tm_mon--)
                   tm->tm_mon=11,
                   tm->tm_year--;
      fputs(asctime(tm), stdout);

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

date manipulation

I'm writing a ksh script in which I want to present the user with a choice of choosing any of the last 15 days. i.e., a list like the following: 20040510 (today) 20040509 (yesterday) 20040508 . . . 20040426 Is there an easy way to produce the date from x number of days ago other than... (3 Replies)
Discussion started by: jalburger
3 Replies

2. Shell Programming and Scripting

Date Manipulation

I need to achieve the following.....I seached the forum but could not find it... This is I have in a file... "CH","TIA","10/27/2006",000590 I need the date in the third field to be attached to fileas 20061027_test.txt How do I do it. (6 Replies)
Discussion started by: mgirinath
6 Replies

3. Shell Programming and Scripting

need help in time manipulation

i have a script that gives the last time the data is inserted in a file. i want to check the time difference b/w the sytem time and the time in file. for e,g. if script runs at 3.30.So $a=3.30 and the time in file is 3.00.So $time =3.00 then the time difference should be 30 min...... ... (6 Replies)
Discussion started by: ali560045
6 Replies

4. Shell Programming and Scripting

date manipulation

HI, I'm comparing my file date with the system date and if both the dates are equal I'm doing some operation. I use two variables for these two dates. I use the following command in my query. if .... But here the current date $cd shows 01 and filedate $fdate shows 1. The file is created on 1 of ... (6 Replies)
Discussion started by: pstanand
6 Replies

5. Shell Programming and Scripting

Time Manipulation in shell script

Hi all, I have a script that requires time comparisons and sending out an email alert only if the specified interval has been completed. The script runs in Cron tab every 5 mins. For ex: If the interval is set to 2 hrs (Dynamic & varies ) My script should execute and if it finds any error... (1 Reply)
Discussion started by: praseecg
1 Replies

6. Shell Programming and Scripting

Date manipulation

Hi Gurus, How to minus 15 minuets from current system time. For example if current time is " Wed Oct 14 12:12:38 BST 2009", i need "Wed Oct 14 11:57:38 BST 2009" Thanks (2 Replies)
Discussion started by: kumarmani
2 Replies

7. Shell Programming and Scripting

Date manipulation

How can i print a future time, so i get current time by date "+%H:M" but how can i say add 20 minutes to the current time and display as I have just done for current time. (1 Reply)
Discussion started by: kelseyh
1 Replies

8. Shell Programming and Scripting

Date Manipulation

I have a file with a field containing the following: "7/3/2009 7:07:12 PM","xxxx" I need to be able to split this field up into two into a different format with the time being converted into 24 hour: so that i can get the following: "20090307","19:07:12","xxxx" (8 Replies)
Discussion started by: Pablo_beezo
8 Replies

9. Shell Programming and Scripting

Date manipulation

In my shell script I take date as a input parameter from command line in the format "21 Oct 2011" which would be date +'%d %b %Y' Now i need to do two things here. 1) Validate the date entered by user 2) Calculate yesterday's date from the input. So in this case it should be: "20 Oct 2011"... (9 Replies)
Discussion started by: davidtd
9 Replies

10. Shell Programming and Scripting

Date-Manipulation-1

Hallo Team I can perform the task manually but i would like to automate this process. ok here goes. I have a perl script which runs every Wednesday every week and the name of the script is check_19.pl This is how the script looks like : #!/usr/bin/perl -w #use strict; use DBI; #... (1 Reply)
Discussion started by: kekanap
1 Replies
Net::DNS::Question(3)					User Contributed Perl Documentation				     Net::DNS::Question(3)

NAME
Net::DNS::Question - DNS question record SYNOPSIS
use Net::DNS::Question; $question = new Net::DNS::Question('example.com', 'A', 'IN'); DESCRIPTION
A Net::DNS::Question object represents a record in the question section of a DNS packet. METHODS
new $question = new Net::DNS::Question('example.com', 'A', 'IN'); $question = new Net::DNS::Question('example.com'); $question = new Net::DNS::Question('192.0.32.10', 'PTR', 'IN'); $question = new Net::DNS::Question('192.0.32.10'); Creates a question object from the domain, type, and class passed as arguments. One or both type and class arguments may be omitted and will assume the default values shown above. RFC4291 and RFC4632 IP address/prefix notation is supported for queries in both in-addr.arpa and ip6.arpa namespaces. decode $question = decode Net::DNS::Question($data, $offset); ($question, $offset) = decode Net::DNS::Question($data, $offset); Decodes the question record at the specified location within a DNS wire-format packet. The first argument is a reference to the buffer containing the packet data. The second argument is the offset of the start of the question record. Returns a Net::DNS::Question object and the offset of the next location in the packet. An exception is raised if the object cannot be created (e.g., corrupt or insufficient data). encode $data = $question->encode( $offset, $hash ); Returns the Net::DNS::Question in binary format suitable for inclusion in a DNS packet buffer. The optional arguments are the offset within the packet data where the Net::DNS::Question is to be stored and a reference to a hash table used to index compressed names within the packet. qname, zname $qname = $question->qname; $zname = $question->zname; Returns the question name attribute. In dynamic update packets, this attribute is known as zname() and refers to the zone name. qtype, ztype $qtype = $question->qtype; $ztype = $question->ztype; Returns the question type attribute. In dynamic update packets, this attribute is known as ztype() and refers to the zone type. qclass, zclass $qclass = $question->qclass; $zclass = $question->zclass; Returns the question class attribute. In dynamic update packets, this attribute is known as zclass() and refers to the zone class. print $object->print; Prints the record to the standard output. Calls the string() method to get the string representation. string print "string = ", $question->string, " "; Returns a string representation of the question record. COPYRIGHT
Copyright (c)1997-2002 Michael Fuhr. Portions Copyright (c)2002-2004 Chris Reinhardt. Portions Copyright (c)2003,2006-2011 Dick Franks. All rights reserved. This program is free software; you may redistribute it and/or modify it under the same terms as Perl itself. SEE ALSO
perl, Net::DNS, Net::DNS::DomainName, Net::DNS::Packet, RFC 1035 Section 4.1.2 perl v5.16.2 2012-01-27 Net::DNS::Question(3)
All times are GMT -4. The time now is 07:47 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy