Portable options for date math are limited. You might have the super-new ksh needed for that, or not. You might have the super-new nawk needed for that, or not. You might have GNU date available, or not.
Or you could use perl, which is available the same way almost everywhere. The current day, in dd-Mon-yyyy format, plus 86400 seconds:
If you don't have the GNU functionality, try tweaking your timezone $TZ
Some systems have a limitation that you cannot go forwards or backwards beyond 24 hours, but some allow a seemingly limitless offset. If your value for $TZ is like GMT0BST........ then you can easily set it:-
If you are with EST5EDT, then:-
Some systems do not have a TZ set. If so, you need to export the value and unset it at the end:-
I hope that this gives you an option, but it is highly OS specific in what it will allow. There are various other date calculation threads on the forums here to search through too.
Hello All,
we what we call a parameter file (.txt) where my application read dynamic values when the job is triggered, one of such values are below:
abc.txt
------------------
line1
line2
line3
$$EDWS_DATE_INSERT=08-27-2019
line4
$$EDWS_PREV_DATE_INSERT=08-26-2019
I am trying to... (1 Reply)
i try to set linux date & time in specific format but it keep giving me error
Example :
date "+%d-%m-%C%y %H:%M:%S" -d "19-01-2017 00:05:01"
or
date +"%d-%m-%C%y %H:%M:%S" -d "19-01-2017 00:05:01"
keep giving me this error :
date: invalid date ‘19-01-2017 00:05:01'
Please use CODE tags... (7 Replies)
I am not able to pass date stored in a variable as an argument to date command. I get current date value for from_date and to_date
#!/usr/bin/ksh
set -x
for s in server ; do
ssh -T $s <<-EOF
from_date="12-Jan-2015 12:02:09"
to_date="24-Jan-2015 13:02:09"
echo \$from_date
echo... (7 Replies)
Hi All,
I am trying to add one day to the busdt variable i am extracting from a file (DynamicParam.env). I am deriving the busdt as below.
Is there any function which I can use to derive as below.
If busdt=20120910, then the new derived variable value should be 20120911
If... (2 Replies)
Dear all,
I have 2 questions.
I have a file with many rows which has date of the format YYYYMMDD.
1. I need to change the date to that weeks friday date(Ex: 20120716(monday) to 20120720). Satuday/Sunday has to be changed to next week friday date too.
2. After converting the date to... (10 Replies)
I am modifying some script and need to have the script reflect the current date. I have the script below. In the section yy="2010",mm="07", dd="12" What would I need to change to have the script automatically input the current year month & date instead of manually updated the script daily?
... (2 Replies)
Okay so I'm not really a newbie, but this bugs the crap out of me (rant on).
Every so often I need to change the system time. I run "man date" and always find the "date -s" command, but for who knows how long, the manual page has *never* listed the format of the input string required to set the... (1 Reply)
Hi folks,
I need to write a script that should activate a process according to the current hour.
The process should be activatet only if the hour is between midnight (00:00) and 07:00.
How should I create the condition?
Thanks in advance,
Nir (2 Replies)
Hi to all...
I'm currently running a C++ program in Unix environment and it is dependent to a Unix environment variable with a date value.
ex: echo $DateToday
20060403
I want to change that date in my C++ program, changing the value date to 20061120 and revert back to original... (6 Replies)
how do i set the system date and time? i know i have to be root to do it but i'm new to unix--really new--and some of this stuff seems really cryptic. thanks for any help.:confused: (2 Replies)