Sponsored Content
Top Forums UNIX for Beginners Questions & Answers Splitting week start date and end date based on custom period start dates Post 303043762 by Chubler_XL on Wednesday 5th of February 2020 06:00:52 PM
Old 02-05-2020
This forum is not a script writing service.

If you have a solution you have worked on that is not complete we can help you, but you must have shown some effort to solve this yourself.

Also because date manipulation in shell script is not very portable, we will need to know the Operating system and shell you are using.
This User Gave Thanks to Chubler_XL For This Post:
 

7 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Compare Start date and End date...

Hi All, I have problem in my file. It has two date variable. There are 2 variables which has the values as below 1. START_MONTH = “Date(YYYYMM) format” Ex: 201008 2. END_MONTH = “Date(YYYYMM) format” Ex: 201105 The end date should be greater than start date. Now we... (3 Replies)
Discussion started by: suresh01_apk
3 Replies

2. Shell Programming and Scripting

Need to capture all dates between start date and End date.

Hi All, I enter Start date and end date as parameters. I need to capture dates between start date and end date. Please let me know if you have any idea the same. Thanks in advance. Nagaraja Akkivalli. (5 Replies)
Discussion started by: Nagaraja Akkiva
5 Replies

3. Shell Programming and Scripting

Need to capture dates between start date and end date Using perl.

Hi All, Want to get all dates and Julian week number for that date between the start date and end date. How can I achive this using perl? (To achive above functionality, I was connecting to the database from DB server. Need to execute the same script in application server, since databse... (6 Replies)
Discussion started by: Nagaraja Akkiva
6 Replies

4. Shell Programming and Scripting

Extract week start,end date from given date in PERL

Hi All, what i want to do in perl is i should give the date at run time .Suppose date given is 23/12/2011(mm/dd/yyyy) the perl script shold find week start date, week end date, previous week start date,end date,next week start date, end date. In this case week start date will be-:12/19/2011... (2 Replies)
Discussion started by: parthmittal2007
2 Replies

5. Shell Programming and Scripting

Getting the Start, End time and duration using date command

Oracle Enterprise Linux We want to track how long a process takes to complete its execution. This is what we want in the schell script Before the process is started , get the time with date, hours and minutes execute the process After the process has ended , get the time with date,... (5 Replies)
Discussion started by: omega3
5 Replies

6. Shell Programming and Scripting

Get the lines from logfile within start and end date

Hi guys, I am having the below logfile,date in yyyy-mm-dd 2013-08-02 *some content* 2013-08-02 *some content* 2013-08-02 *some content* 2013-08-03 *some content* 2013-08-05 *some content* from the above logfile i need to get the lines between the two timestamps,if i give... (5 Replies)
Discussion started by: mohanalakshmi
5 Replies

7. UNIX for Dummies Questions & Answers

Print start date to end date, given $1 & $2 in ksh

Dear all, I have an user passing 2 parameter 31/03/2015 and 02/04/2015 to a ksh script. How to print the start date to end date. Expected output is : 31/03/2015 01/04/2015 02/04/2015 Note : 1. Im using aix and ksh 2. I have tried to convert the given input into a date, didnt... (0 Replies)
Discussion started by: mr.rajaravi
0 Replies
STRTOTIME(3)								 1							      STRTOTIME(3)

strtotime - Parse about any English textual datetime description into a Unix timestamp

SYNOPSIS
int strtotime (string $time, [int $now = time()]) DESCRIPTION
The function expects to be given a string containing an English date format and will try to parse that format into a Unix timestamp (the number of seconds since January 1 1970 00:00:00 UTC), relative to the timestamp given in $now, or the current time if $now is not supplied. Each parameter of this function uses the default time zone unless a time zone is specified in that parameter. Be careful not to use dif- ferent time zones in each parameter unless that is intended. See date_default_timezone_get(3) on the various ways to define the default time zone. PARAMETERS
o $time -A date/time string. Valid formats are explained in Date and Time Formats. o $now - The timestamp which is used as a base for the calculation of relative dates. RETURN VALUES
Returns a timestamp on success, FALSE otherwise. Previous to PHP 5.1.0, this function would return -1 on failure. ERRORS
/EXCEPTIONS Every call to a date/time function will generate a E_NOTICE if the time zone is not valid, and/or a E_STRICT or E_WARNING message if using the system settings or the $TZ environment variable. See also date_default_timezone_set(3) CHANGELOG
+--------+---------------------------------------------------+ |Version | | | | | | | Description | | | | +--------+---------------------------------------------------+ | 5.3.0 | | | | | | | Prior to PHP 5.3.0, relative time formats sup- | | | plied to the $time argument of strtotime(3) such | | | as this week, previous week, last week, and next | | | week were interpreted to mean a 7 day period rel- | | | ative to the current date/time, rather than a | | | week period of Monday through Sunday. | | | | | 5.3.0 | | | | | | | Prior to PHP 5.3.0, 24:00 was not a valid format | | | and strtotime(3) returned FALSE. | | | | | 5.2.7 | | | | | | | In PHP 5 prior to 5.2.7, requesting a given | | | occurrence of a given weekday in a month where | | | that weekday was the first day of the month would | | | incorrectly add one week to the returned time- | | | stamp. This has been corrected in 5.2.7 and later | | | versions. | | | | | 5.1.0 | | | | | | | Now returns FALSE on failure, instead of -1. | | | | | 5.1.0 | | | | | | | Now issues the E_STRICT and E_NOTICE time zone | | | errors. | | | | | 5.0.2 | | | | | | | In PHP 5 up to 5.0.2, "now" and other relative | | | times are wrongly computed from today's midnight. | | | This differs from other versions where it is cor- | | | rectly computed from current time. | | | | | 5.0.0 | | | | | | | Microseconds began to be allowed, but they are | | | ignored. | | | | +--------+---------------------------------------------------+ EXAMPLES
Example #1 A strtotime(3) example <?php echo strtotime("now"), " "; echo strtotime("10 September 2000"), " "; echo strtotime("+1 day"), " "; echo strtotime("+1 week"), " "; echo strtotime("+1 week 2 days 4 hours 2 seconds"), " "; echo strtotime("next Thursday"), " "; echo strtotime("last Monday"), " "; ?> Example #2 Checking for failure <?php $str = 'Not Good'; // previous to PHP 5.1.0 you would compare with -1, instead of false if (($timestamp = strtotime($str)) === false) { echo "The string ($str) is bogus"; } else { echo "$str == " . date('l dS of F Y h:i:s A', $timestamp); } ?> NOTES
Note If the number of the year is specified in a two digit format, the values between 00-69 are mapped to 2000-2069 and 70-99 to 1970-1999. See the notes below for possible differences on 32bit systems (possible dates might end on 2038-01-19 03:14:07). Note The valid range of a timestamp is typically from Fri, 13 Dec 1901 20:45:54 UTC to Tue, 19 Jan 2038 03:14:07 UTC. (These are the dates that correspond to the minimum and maximum values for a 32-bit signed integer.) Prior to PHP 5.1.0, not all platforms support negative timestamps, therefore your date range may be limited to no earlier than the Unix epoch. This means that e.g. dates prior to Jan 1, 1970 will not work on Windows, some Linux distributions, and a few other operating systems. For 64-bit versions of PHP, the valid range of a timestamp is effectively infinite, as 64 bits can represent approximately 293 bil- lion years in either direction. Note Dates in the m/d/y or d-m-y formats are disambiguated by looking at the separator between the various components: if the separator is a slash ( /), then the American m/d/y is assumed; whereas if the separator is a dash ( -) or a dot ( .), then the European d-m-y format is assumed. To avoid potential ambiguity, it's best to use ISO 8601 ( YYYY-MM-DD) dates or DateTime::createFromFormat when possible. Note Using this function for mathematical operations is not advisable. It is better to use DateTime::add and DateTime::sub in PHP 5.3 and later, or DateTime::modify in PHP 5.2. SEE ALSO
Date and Time Formats, DateTime::createFromFormat, checkdate(3), strptime(3). PHP Documentation Group STRTOTIME(3)
All times are GMT -4. The time now is 11:12 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy