I asked what version of shell you're using, but you didn't provide an answer to that question. With a recent Korn shell, such as version 93u+, (which may be installed as ksh93 on AIX 7.1) you could try a simplified version of:
which if invoked with the operands FILE_NAME_20180410, FILE_NAME_20180413, and FILE_NAME_20180409 produces the output:
Last edited by Don Cragun; 04-14-2018 at 12:02 AM..
Reason: Fix typo: doubled \n in printf format.
This User Gave Thanks to Don Cragun For This Post:
Hi,
I have a date input in MMDDYYYY format..
I have to give the day (whether that DD is sunday/monday...)
Is there any command for it...
Or do I have to write a script for that...
Thanks in Advance
Yeheya (1 Reply)
Hi,
I have a date field which is a variable field being passed to the script from outside.
I need to know how i can add 1 day to it.
I have seen example of date subtraction but while adding each time date reaches 31 or 30 i have to put if else condition.
Or for leap year also.
Kindly let... (4 Replies)
Hi, I have been trying just about every unix command to come up with yesterday's date (today's date - 1). I have seen all of the help on this forum, and none of it seems to work for me here. We are using Sun Solaris 9 Unix. I am using this script to create a .txt file with ftp commands that I will... (2 Replies)
i would need some help in setting the value of a variable (TIME_NOW) depending on the time of the day ...e.g.
if today's date is 12th April 2009 and if the current time is between midnight and 16:59:59 hrs then the TIME_NOW should be yesterday's date i.e. TIME_NOW=11
else if the current time... (3 Replies)
It's easy as pie to get the date minus one day on opensolaris:
date -d "-1 day" +"%Y%m%d"run this command on our crappy Solaris 10 machines however (which I'm guessing doesn't have GNU date running on it) and you get:
date: illegal option -- d
date: illegal option -- 1
date: illegal option --... (5 Replies)
Hi guys,
I had a scenario...
1. I had to get the previous days date in yyyymmdd format
2. i had to create a file with Date inthe format yyyymmdd.txt format
both are different
thanks guys in advance.. (4 Replies)
I need to get the next day's date of the user entered date
for example:
Enter date (yyyy/mm/yy):
2013/10/08I need to get the next day's date of the user entered date
Desired Output:
2013/10/09Though there are ways to achieve this is Linux or Unix environment (date command) ,I need to... (1 Reply)
I Have text like
XXX_20190908.csv.gz need to replace Only date in this format with current date every day
Thanks! (1 Reply)
Discussion started by: yamasani1991
1 Replies
LEARN ABOUT DEBIAN
html::calendarmonth::datetool
HTML::CalendarMonth::DateTool(3pm) User Contributed Perl Documentation HTML::CalendarMonth::DateTool(3pm)NAME
HTML::CalendarMonth::DateTool - Base class for determining which date package to use for calendrical calculations.
SYNOPSIS
my $date_tool = HTML::CalendarMonth::DateTool->new(
year => $YYYY_year,
month => $one_thru_12_month,
weeknum => $weeknum_mode,
historic => $historic_mode,
datetool => $specific_datetool_if_desired,
);
DESCRIPTION
This module attempts to utilize the best date calculation package available on the current system. For most contemporary dates this usually
ends up being the internal Time::Local package of perl. For more exotic dates, or when week number of the years are desired, other methods
are attempted including DateTime, Date::Calc, Date::Manip, and the linux/unix 'ncal' or 'cal' commands. Each of these has a specific
subclass of this module offering the same utility methods needed by HTML::CalendarMonth.
METHODS
new()
Constructor. Takes the following parameters:
year
Year of calendar in question (required). If you are rendering exotic dates (i.e. dates outside of 1970 to 2038) then something
besides Time::Local will be used for calendrical calculations.
month
Month of calendar in question (required). 1 through 12.
weeknum
Optional. When specified, will limit class excursions to those that are currently set up for week of year calculations.
historic
Optional. If the the ncal or cal commands are available, use one of them rather than other available date modules since these
utilities accurately handle some specific historical artifacts such as the transition from Julian to Gregorian.
datetool
Optional. Mostly for debugging, this option can be used to indicate a specific HTML::CalendarMonth::DateTool subclass for
instantiation. The value can be either the actual utility class, e.g., Date::Calc, or the name of the CalendarMonth handler leaf
class, e.g. DateCalc. Use 'ncal' or 'cal', respectively, for the wrappers around those commands.
There are number of methods automatically available:
month()
year()
weeknum()
historical()
datetool()
Accessors for the parameters provided to "new()" above.
dow1st()
Returns the day of week number for the 1st of the "year" and "month" specified during the call to "new()". Relies on the presence of
"dow1st_and_lastday()". Should be 0..6 starting with Sun.
lastday()
Returns the last day of the month for the "year" and "month" specified during the call to "new()". Relies on the presence of
"dow1st_and_lastday()".
Overridden methods
Subclasses of this module must provide at least the "day_epoch()" and "dow1st_and_lastday()" methods.
dow1st_and_lastday()
Required. Provides a list containing the day of the week of the first day of the month (0..6 starting with Sun) along with the last day
of the month.
day_epoch()
Optional unless interested in epoch values for wacky dates. For a given day, and optionally "month" and "year" if they are different
from those specified in "new()", provide the unix epoch in seconds for that day at midnight.
If the subclass is expected to provide week of year numbers, three more methods are necessary:
dow()
For a given day, and optionally "month" and "year" if they are different from those specified in "new()", provide the day of week
number. (1=Sunday, 7=Saturday).
add_days($days, $delta, $day, [$month], [$year])
For a given day, and optionally "month" and "year" if they are different from those specified in "new()", provide a list of year,
month, and day once "delta" days have been added.
week_of_year($day, [$month], [$year])
For a given day, and optionally "month" and "year" if they are different from those specified in "new()", provide a list with the week
number of the year along with the year. (some days of a particular year can end up belonging to the prior or following years).
AUTHOR
Matthew P. Sisk, <sisk@mojotoad.com>
COPYRIGHT
Copyright (c) 2010 Matthew P. Sisk. All rights reserved. All wrongs revenged. This program is free software; you can redistribute it and/or
modify it under the same terms as Perl itself.
SEE ALSO HTML::CalendarMonth(3), Time::Local(3), DateTime(3), Date::Calc(3), Date::Manip(3), cal(1)perl v5.12.4 2011-08-26 HTML::CalendarMonth::DateTool(3pm)