Sponsored Content
Full Discussion: General Purpose Date Script
Top Forums UNIX for Beginners Questions & Answers General Purpose Date Script Post 302868037 by targzeta on Friday 25th of October 2013 05:09:55 PM
Old 10-25-2013
Ok, I'm using Linux Slackware64 but...
Code:
perl date.pl 
Can't locate Switch.pm in @INC (you may need to install the Switch module) (@INC contains: /usr/local/lib64/perl5
 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5 .) at date.pl line 3.
BEGIN failed--compilation aborted at date.pl line 3.

it seems that Switch it's no so standard Smilie.

Is it a bug?
Code:
# 1)
$> date --date="2013/10/20 - 203 days" '+%Y-%m-%d %H-%M-%S'
2013-03-31 00-00-00

$> perl date.pl -d '2013/10/20 - 203 days'
2013-03-30 23:00:00

# 2)
$> date --date="2013/10/25 + 3 days" '+%Y-%m-%d %H-%M-%S'
2013-10-28 00-00-00

$> perl date.pl -d '2013/10/25 + 3 days'
2013-10-27 23:00:00

# 3)
$> perl date.pl -d 'now + 3 days'
Unknown argument now

$> perl date.pl -d 'today + 3 days'
Unknown argument today

I think it's very hard what you're trying to do.

Emanuele
This User Gave Thanks to targzeta For This Post:
 

8 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Looking for a general purpose System Monitor

Does anyone have any scripts or suggestions on a general purpose Unix/Linux monitoring tool? (5 Replies)
Discussion started by: darthur
5 Replies

2. UNIX for Dummies Questions & Answers

whats the purpose of the following script?

whats the purpose of the following script? who could run it? To what is the script refering that exceeds 75%? The mailbox? What does sed 's/%//' do? (1 Reply)
Discussion started by: vrn
1 Replies

3. Shell Programming and Scripting

General Q: how to run/schedule a php script from cron jobs maybe via bash from shell?

Status quo is, within a web application, which is coded completely in php (not by me, I dont know php), I have to fill out several fields, and execute it manually by clicking the "go" button in my browser, several times a day. Thats because: The script itself pulls data (textfiles) from a... (3 Replies)
Discussion started by: lowmaster
3 Replies

4. Shell Programming and Scripting

awk (?) help or just general script

I have two files (___ represents blanks) Foo1 1000 345 456 1001 876 908 1002 ___ 786 1003 643 908 1004 345 234 and Foo2 1000 345 1001 876 1002 111 1003 643 1004 345 (3 Replies)
Discussion started by: garethsays
3 Replies

5. Shell Programming and Scripting

script to fill up disk space for testing purpose

Hello everyone I am new to this forum I am working on a project and needed a test script to fill up a disk partition /tmp/data to see how the program fails. The system I am working on is a redhat 5.3. Is there anything out there? Thanks. (10 Replies)
Discussion started by: dp100022
10 Replies

6. UNIX for Dummies Questions & Answers

Purpose of - (hypen) in script or command line

Hi, I am new for unix and I am following ABS guide. What is the purpose of - (hypen ) in the below command and What it will do in this?. Can anyone explain it in detail. Rest of the things in the below command I understood somewhat. (cd /source/directory && tar cf - . ) | (cd /dest/directory &&... (1 Reply)
Discussion started by: gwgreen1
1 Replies

7. Shell Programming and Scripting

Script to determine Date,TotalFile,total size of file based on date

I have file listed like below -rw-r--r--+ 1 test test 17M Nov 26 14:43 test1.gz -rw-r--r--+ 1 test test 0 Nov 26 14:44 test2.gz -rw-r--r--+ 1 test test 0 Nov 27 10:41 test3.gz -rw-r--r--+ 1 test test 244K Nov 27 10:41 test4.gz -rw-r--r--+ 1 test test 17M Nov 27 10:41 test5.gz I... (5 Replies)
Discussion started by: krish2014
5 Replies

8. UNIX for Beginners Questions & Answers

General Purpose XML Processing

I've been kicking this around for a while now, I might as well post it here. v0.0.9, now properly supporting self-closing tags. v0.0.8, an important quoting fix and a minor change which should handle special <? <!-- etc. tags without seizing up as often. Otherwise the code hasn't changed much.... (6 Replies)
Discussion started by: Corona688
6 Replies
Image::ExifTool::Shift(3)				User Contributed Perl Documentation				 Image::ExifTool::Shift(3)

NAME
Image::ExifTool::Shift.pl - ExifTool time shifting routines DESCRIPTION
This module contains routines used by ExifTool to shift date and time values. DETAILS
Time shifts are applied to standard EXIF-formatted date/time values (ie. "2005:03:14 18:55:00"). Date-only and time-only values may also be shifted, and an optional timezone (ie. "-05:00") is also supported. Here are some general rules and examples to explain how shift strings are interpreted: Date-only values are shifted using the following formats: 'Y:M:D' - shift date by 'Y' years, 'M' months and 'D' days 'M:D' - shift months and days only 'D' - shift specified number of days Time-only values are shifted using the following formats: 'h:m:s' - shift time by 'h' hours, 'm' minutes and 's' seconds 'h:m' - shift hours and minutes only 'h' - shift specified number of hours Timezone shifts are specified in the following formats: '+h:m' - shift timezone by 'h' hours and 'm' minutes '-h:m' - negative shift of timezone hours and minutes '+h' - shift timezone hours only '-h' - negative shift of timezone hours only A valid shift value consists of one or two arguments, separated by a space. If only one is provided, it is assumed to be a time shift when applied to a time-only or a date/time value, or a date shift when applied to a date-only value. For example: '7' - shift by 1 hour if applied to a time or date/time value, or by one day if applied to a date value '2:0' - shift 2 hours (time, date/time), or 2 months (date) '5:0:0' - shift 5 hours (time, date/time), or 5 years (date) '0:0:1' - shift 1 s (time, date/time), or 1 day (date) If two arguments are given, the date shift is first, followed by the time shift: '3:0:0 0' - shift date by 3 years '0 15:30' - shift time by 15 hours and 30 minutes '1:0:0 0:0:0+5:0' - shift date by 1 year and timezone by 5 hours A date shift is simply ignored if applied to a time value or visa versa. Numbers specified in shift fields may contain a decimal point: '1.5' - 1 hour 30 minutes (time, date/time), or 1 day (date) '2.5 0' - 2 days 12 hours (date/time), 12 hours (time) or 2 days (date) And to save typing, a zero is assumed for any missing numbers: '1::' - shift by 1 hour (time, date/time) or 1 year (date) '26:: 0' - shift date by 26 years '+:30 - shift timezone by 30 minutes Below are some specific examples applied to real date and/or time values ('Dir' is the applied shift direction: '+' is positive, '-' is negative): Original Value Shift Dir Shifted Value --------------------- ------- --- --------------------- '20:30:00' '5' + '01:30:00' '2005:01:27' '5' + '2005:02:01' '11:54:00' '2.5 0' - '23:54:00' '2005:11:02' '2.5 0' - '2005:10:31' '2005:11:02 11:54:00' '2.5 0' - '2005:10:30 23:54:00' '2004:02:28 08:00:00' '1 1.3' + '2004:02:29 09:18:00' '07:00:00' '-5' + '07:00:00' '07:00:00+01:00' '-5' + '07:00:00-04:00' '07:00:00Z' '+2:30' - '07:00:00-02:30' '1970:01:01' '35::' + '2005:01:01' '2005:01:01' '400' + '2006:02:05' '10:00:00.00' '::1.33' + '09:59:58.67' NOTES
The format of the original date/time value is not changed when the time shift is applied. This means that the length of the date/time string will not change, and only the numbers in the string will be modified. The only exception to this rule is that a 'Z' timezone is changed to '+00:00' notation if a timezone shift is applied. A timezone will not be added to the date/time string. TRICKY
This module is perhaps more complicated than it needs to be because it is designed to be very flexible in the way time shifts are specified and applied... The ability to shift dates by Y years, M months, etc, is somewhat contradictory to the goal of maintaining a constant shift for all time values when applying a batch shift. This is because shifting by 1 month can be equivalent to anything from 28 to 31 days, and 1 year can be 365 or 366 days, depending on the starting date. The inconsistency is handled by shifting the first tag found with the actual specified shift, then calculating the equivalent time difference in seconds for this shift and applying this difference to subsequent tags in a batch conversion. So if it works as designed, the behaviour should be both intuitive and mathematically correct, and the user shouldn't have to worry about details such as this (in keeping with Perl's "do the right thing" philosophy). AUTHOR
Copyright 2003-2010, Phil Harvey (phil at owl.phy.queensu.ca) This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. SEE ALSO
Image::ExifTool(3pm) perl v5.12.1 2010-01-04 Image::ExifTool::Shift(3)
All times are GMT -4. The time now is 02:12 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy