10 More Discussions You Might Find Interesting
1. UNIX for Beginners Questions & Answers
hi guys
i want to know how can i insert in a variable yesterday for example :
today=`date +%Y%m%d`
yesterday =???
thanks a lot
Please use CODE tags as required by forum rules! (4 Replies)
Discussion started by: Francesco_IT
4 Replies
2. Shell Programming and Scripting
Hi Friend,
i am using OS
HP-UX vvftf320 B.11.11 U 9000/800 511076331 unlimited-user license
now i have used below command but it giving today's date. i need your help to get yesterdate. Please correct me.
date +"%d%m%Y%H%M%S" -d "1 days ago
Thanks in advance,
Jewel (3 Replies)
Discussion started by: Jewel
3 Replies
3. Shell Programming and Scripting
HI All,
I am trying so long to find the yesterday's date to run a script but i failed
kinldy share the command to find yesterday's date in ksh
i tried with
date --date='1 day ago'
but it displaying error
your help will highly apeerciated.
Thanks (7 Replies)
Discussion started by: thelakbe
7 Replies
4. Shell Programming and Scripting
curdate=$(date +"%d-%b-%y")
How to get the yesterday's date. (1 Reply)
Discussion started by: sandy1028
1 Replies
5. Shell Programming and Scripting
Hi,
`date` command will give the current days date.
Is there any command to get the previous day date?
I need the previous day value in my script.
Ahamed. (1 Reply)
Discussion started by: ahamed
1 Replies
6. Shell Programming and Scripting
I was playing to find a simple way to get yesterday's date, and came up with this (on an AIX 5.2 box):
$ date
Thu Feb 19 11:21:26 EST 2009
$ echo $TZ
EST5EDT
$ yesterday=`TZ=$(date +%Z)+24 date`
$ echo $yesterday
Wed Feb 18 16:21:52 GMT 2009
Why it is converted to GMT instead of... (2 Replies)
Discussion started by: gratus
2 Replies
7. UNIX for Dummies Questions & Answers
I haven't been using linux very long( and when I say that its only been about 1 week for me) I was told to do the following:
Create a Bash script that will copy all the files and subdirectories in one directory to a newly created directory. You may name the receiving directory anything you like.... (4 Replies)
Discussion started by: reecygee
4 Replies
8. Shell Programming and Scripting
I am not using GNU nor BSD. On AIX, how do you return yesterday in the format of i.e. "May 09" with a space.
# `TZ=y380 date +%h""%d`
>> May09
# `TZ=y380 date +%h" "%d`
>> May
I appreciate your help in advance.
thx (3 Replies)
Discussion started by: Daniel Gate
3 Replies
9. Shell Programming and Scripting
Hello, using date, we can easily get today's date
$ date +%y-%m-%d
06-12-08
is it possible for me to get yesterday's date using 'date', if not, is there any quick and easy way to do that?
Thanks! (1 Reply)
Discussion started by: fedora
1 Replies
10. UNIX for Dummies Questions & Answers
Does anyone know of an easy way to use the date function to get yesterday's date in this format: Nov 21 ? (2 Replies)
Discussion started by: ssmiths001
2 Replies
Historical(3pm) User Contributed Perl Documentation Historical(3pm)
NAME
Cache::Historical - Cache historical values
SYNOPSIS
use Cache::Historical;
my $cache = Cache::Historical->new();
# Set a key's value on a specific date
$cache->set( $dt, $key, $value );
# Get a key's value on a specific date
my $value = $cache->get( $dt, $key );
# Same as 'get', but if we don't have a value at $dt, but we
# do have values for dates < $dt, return the previous
# historic value.
$cache->get_interpolated( $dt, $key );
DESCRIPTION
Cache::Historical caches historical values by key and date. If you have something like historical stock quotes, for example
2008-01-02 msft 35.22
2008-01-03 msft 35.37
2008-01-04 msft 34.38
2008-01-07 msft 34.61
then you can store them in Cache::Historical like
my $cache = Cache::Historical->new();
my $fmt = DateTime::Format::Strptime->new(
pattern => "%Y-%m-%d");
$cache->set( $fmt->parse_datetime("2008-01-02"), "msft", 35.22 );
$cache->set( $fmt->parse_datetime("2008-01-03"), "msft", 35.37 );
$cache->set( $fmt->parse_datetime("2008-01-04"), "msft", 34.38 );
$cache->set( $fmt->parse_datetime("2008-01-07"), "msft", 34.61 );
and retrieve them later by date:
my $dt = $fmt->parse_datetime("2008-01-03");
# Returns 35.37
my $value = $cache->get( $dt, "msft" );
Even if there's no value available for a given date, but there are historical values that predate the requested date, "get_interpolated()"
will return the next best historical value:
my $dt = $fmt->parse_datetime("2008-01-06");
# Returns undef, no value available for 2008-01-06
my $value = $cache->get( $dt, "msft" );
# Returns 34.48, the value for 2008-01-04, instead.
$value = $cache->get_interpolated( $dt, "msft" );
Methods
new()
Creates the object. Takes the SQLite file to put the date into as an additional parameter:
my $cache = Cache::Historical->new(
sqlite_file => "/tmp/mydata.dat",
);
The SQLite file defaults to
$HOME/.cache-historical/cache-historical.dat
so if you have multiple caches, you need to use different SQLite files.
time_range()
# List the time range for which we have values for $key
my($from, $to) = $cache->time_range( $key );
keys()
# List all keys
my @keys = $cache->keys();
values()
# List all the values we have for $key, sorted by date
# ([$dt, $value], [$dt, $value], ...)
my @results = $cache->values( $key );
clear()
# Remove all values for a specific key
$cache->clear( $key );
# Clear the entire cache
$cache->clear();
last_update()
# Return a DateTime object of the last update of a given key
my $when = $cache->last_update( $key );
since_last_update()
# Return a DateTime::Duration object since the time of the last
# update of a given key.
my $since = $cache->since_last_update( $key );
LEGALESE
Copyright 2007-2011 by Mike Schilli, all rights reserved. This program is free software, you can redistribute it and/or modify it under
the same terms as Perl itself.
AUTHOR
2007, Mike Schilli <cpan@perlmeister.com>
perl v5.10.1 2011-04-27 Historical(3pm)