Sponsored Content
Top Forums Shell Programming and Scripting Function to find day of any given date. Post 302193987 by chella on Monday 12th of May 2008 03:06:05 AM
Old 05-12-2008
Hi Varma,

Have a look at the datecalc function. It will help you

Regards,
Chella
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Write a shell script to find whether the first day of the month is a working day

Hi , I am relatively new to unix... Can u pls help me out to find out if the first day of the month is a working day ie from (Monday to Friday)...using Date and If clause in Korn shell.. This is very urgent. Thanks for ur help... (7 Replies)
Discussion started by: phani
7 Replies

2. UNIX for Dummies Questions & Answers

How to find Day of the Week from the given date (Perl)?

How to find the Day of the Week of the given Date using perl? If I have a date in YYY--MM-DD format, how to find the DOW? Based on that, I need to find the following sunday. Pls help. (5 Replies)
Discussion started by: deepakwins
5 Replies

3. Shell Programming and Scripting

Script to find previous month last day minus one day timestamp

Hi All, I need to find the previous month last day minus one day, using shell script. Can you guys help me to do this. My Requirment is as below: Input for me will be 2000909(YYYYMM) I need the previous months last day minus 1 day timestamp. That is i need 2000908 months last day minus ... (3 Replies)
Discussion started by: girish.raos
3 Replies

4. HP-UX

To find day out of date in HP-unix

Dear Frends, Could you please help me with the command or option by which I can find day where the input is date(can be of future or past). I do have for linux, However it is not working @ hp unix. Please help. Regards Rahul (4 Replies)
Discussion started by: Rahul chitriv
4 Replies

5. Shell Programming and Scripting

Function to get day of week from YYYY-MM-DD date

Can't find out how to get the day of the week from a given date, anyone got a code snippet that could help please? Ta!! (4 Replies)
Discussion started by: couponmeup
4 Replies

6. Shell Programming and Scripting

how to obtain date and day of the week from `date` command

Hi, does anybody know how to format `date` command correctly to return the day of the week? Thanks -A I work in ksh.... (1 Reply)
Discussion started by: aoussenko
1 Replies

7. Shell Programming and Scripting

finding the previous day date and creating a file with date

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)
Discussion started by: apple2685
4 Replies

8. Shell Programming and Scripting

find files for next day of the date entered

i have few files generated everyday with a date stamp. Sometimes it happens that if the files are generated late i.e after 00:00 hrs the date stamp will be of the next day. example: 110123_file1 110123_file2 110123_file3 110124_file4 in the above example file4 is also for the previous... (2 Replies)
Discussion started by: gpk_newbie
2 Replies

9. Shell Programming and Scripting

How to find the date of previous day in shell script?

Hi Experts, i am using the below code get the date of previous day. #!/usr/bin/ksh datestamp=`date '+%Y%m%d'` yest=$((datestamp -1)) echo $yest When i execute the code i am getting output as: 20130715 What i am trying here is, based on the date passed i am fetching previus day's... (0 Replies)
Discussion started by: learner24
0 Replies

10. UNIX for Beginners Questions & Answers

Replace date in file every day with current date

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
Test::MockTime::DateCalc(3pm)				User Contributed Perl Documentation			     Test::MockTime::DateCalc(3pm)

NAME
Test::MockTime::DateCalc -- fake time for Date::Calc functions SYNOPSIS
use Test::MockTime; use Test::MockTime::DateCalc; # before Date::Calc loads # ... use My::Module::Using::Date::Calc; DESCRIPTION
"Test::MockTime::DateCalc" arranges for the functions in "Date::Calc" to follow the Perl level "time" function (see perlfunc), and in particular any fake date/time set there by "Test::MockTime". The following "Date::Calc" functions are changed System_Clock Today Now Today_and_Now This_Year Gmtime Localtime Timezone Time_to_Date "Gmtime", "Localtime", "Timezone" and "Time_to_Date" are made to default to the Perl-level current "time". When called with an explicit time argument they're unchanged. Module Load Order "Test::MockTime" or similar fakery must be loaded first, before anything with a "time()" call, which includes "Test::MockTime::DateCalc". This is the same as all "CORE::GLOBAL" overrides, see "OVERRIDING CORE FUNCTIONS" in CORE. "Test::MockTime::DateCalc" must be loaded before "Date::Calc". If "Date::Calc" is already loaded then its functions might have been imported into other modules and such imports are not affected by the redefinitions made. For that reason "Test::MockTime::DateCalc" demands it be the one to load "Date::Calc" for the first time. Usually this simply means having "Test::MockTime::DateCalc" at the start of a test script, before the things you're going to test. use strict; use warnings; use Test::MockTime ':all'; use Test::MockTime::DateCalc; use My::Foo::Bar; set_fixed_time('1981-01-01T00:00:00Z'); is (My::Foo::Bar::something(), 1981); restore_time(); In a test script it's often good to have your own modules early to check they correctly load their pre-requisites. You might want a separate test script for that so you don't accidentally rely on "Test::MockTime::DateCalc" loading "Date::Calc" for you. Other Faking Modules "Test::MockTime::DateCalc" can be used with other modules which mangle the Perl-level "time" too. For example "Time::Fake", use Time::Fake; # fakery first use Test::MockTime::DateCalc; Or "Time::Mock", use Time::Mock; # fakery first use Test::MockTime::DateCalc; "Time::Warp" (as of version 0.5) only exports a new "time", it's not a core override and so can't be used with "Test::MockTime::DateCalc". SEE ALSO
Date::Calc, Test::MockTime, Time::Fake, Time::Mock faketime(1) HOME PAGE
http://user42.tuxfamily.org/test-mocktime-datecalc/index.html COPYRIGHT
Copyright 2009, 2010 Kevin Ryde Test-MockTime-DateCalc is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3, or (at your option) any later version. Test-MockTime-DateCalc is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with Test-MockTime-DateCalc. If not, see <http://www.gnu.org/licenses/>. perl v5.10.1 2010-09-15 Test::MockTime::DateCalc(3pm)
All times are GMT -4. The time now is 04:38 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy