Sponsored Content
Full Discussion: Date issue
Top Forums UNIX for Beginners Questions & Answers Date issue Post 303039296 by vedanta on Sunday 29th of September 2019 05:25:07 PM
Old 09-29-2019
I have made some correction. Please let me know if there is a better way to do it.


Code:
unset date_to
unset date_from
unset counter=15
date_to=$(date -d 2018-06-15 +"%Y%m%d")    
todate=$(date -d 2018-08-18 +"%Y%m%d")  
counter=0
while [ $date_to -lt $todate ]; #put the loop where you need it
do
 date_from=$(date -d "$date_to +1 days" '+%Y%m%d') 
 date_to=$(date -d "$date_from +$counter days" '+%Y%m%d')
 echo "date from"$date_from
 echo "date to" $date_to 
 ls -lrt $(find . -type f -newermt $date_from \! -newermt $date_to )
done

 

10 More Discussions You Might Find Interesting

1. Programming

date issue

hi all: I want to create a new file dynamically for each day.how can i do this. eg.. struct tm tm; while(1) { if(tm.tm_hr==0 && tm.tm_min=0 && tm.tm_sec==0) { //create a new file.. ... (3 Replies)
Discussion started by: bankpro
3 Replies

2. UNIX for Advanced & Expert Users

date issue-find prevoius date in a patricular format

Hi , I have written a shell script that takes the current date on the server and stores it in a file. echo get /usr/home/data-`date '+%Y%d'`.xml> /usr/local/sandeep/GetFILE.ini I call this GetFILE.ini file from an sftp program to fetch a file from /usr/home/ as location. The file is in... (3 Replies)
Discussion started by: bsandeep_80
3 Replies

3. Shell Programming and Scripting

Simple date issue

Hi all, i have used the search already before someone shouts at me and i have seen the 'datecalc' program but this is not working correctly for me in the shell and environment i am using. I am using solaris 10 and bourne shell. I have two dates '07-04-2009' and '05-05-2009'. I just need to... (2 Replies)
Discussion started by: muay_tb
2 Replies

4. Solaris

Cron Date issue

Hi, We have Solaris10.2.3 server. If we execute command `date` on Command Line Promt it shows time - >Tue Jun 23 11:35:55 BST 2009 - which is correct However if the command is executed through cron it gives - >Tue Jun 23 10:35:55 ESTEDT 2009 - which is wrong Request you to help me in... (1 Reply)
Discussion started by: sk2304
1 Replies

5. Shell Programming and Scripting

sort date issue

Hi Everyone, # cat b Sat 12 Sep 2009 10:31:49 PM MYT;a;a;a;Sun 13 Sep 2009 11:32:49 AM MYT; Sat 13 Sep 2009 10:31:49 PM MYT;a;a;a;Mon 14 Sep 2009 10:31:49 PM MYT; Sat 14 Sep 2009 10:31:49 PM MYT;a;a;a;Sun 13 Sep 2009 10:31:49 PM MYT; # sort -t';' -k5 b Sat 13 Sep 2009 10:31:49 PM... (8 Replies)
Discussion started by: jimmy_y
8 Replies

6. Shell Programming and Scripting

Date issue

Hi I need to write a shell script (bash) that takes a date as an in-parameter an decides if its winter or summer time. I have diffrent dates like 20150112 , 200901028 , 200100605 etc. The rule for winter/summer time is : Summer time spans between the last Sunday in march 02:00 to the... (2 Replies)
Discussion started by: duffnix
2 Replies

7. Shell Programming and Scripting

date printing issue

Hello folks Below command shows current date echo `date +%Y-%m-%d` 2010-04-21 How to show one day old date, i want see like 2010-04-20 (1 Reply)
Discussion started by: learnbash
1 Replies

8. Shell Programming and Scripting

Date related issue

Hi, I have TDATE=$(date '+%b %d') That stores "Sep 01" in the TDATE. How I can store "Sep 1"? Thanks in advance (3 Replies)
Discussion started by: dipeshvshah
3 Replies

9. Shell Programming and Scripting

Simple date issue

Hi , Here is the smaller version of the problem. Working individually as command ************************>echo $SHELL /bin/bash ************************>TO_DAY=`date` ************************>echo $TO_DAY Tue Jul 16 02:28:31 EDT 2013 ************************> Not working when... (5 Replies)
Discussion started by: Anupam_Halder
5 Replies

10. Shell Programming and Scripting

Date issue

I have posted a code last week about that date format problem, well I have figured out a much lesser coding. #!/usr/bin/bash clear export NLS_LANG=AMERICAN_AMERICA.AL32UTF8 if ; then echo " Incorrect Number of Arguments"; echo " Usage : Main_Script <FROM_DATE>... (1 Reply)
Discussion started by: Chandan_Bose
1 Replies
LedgerSMB::DBObject::Company(3pm)			User Contributed Perl Documentation			 LedgerSMB::DBObject::Company(3pm)

NAME
LedgerSMB::DBObject::Company - Base utility functions for processing customers and vendors. SYNOPSIS
This library contains the base utility functions for creating, saving, and retrieving customers and vendors. METHODS
$company->set_entity_class() This is a stub for a private method that subclasses are expected to overwrite. It will be set to the account class of the entity (1 for vendor, 2 for customer, etc). get_by_cc This retrieves the company header information by control code. Leaves the overall account class untouched. save() This stores the company record including a credit account in the database. TODO: Separate company from credit account storage. delete_contact required request variables: contact_class_id: int id of contact class contact: text of contact information Must include at least one of: credit_id: int of entity_credit_account.id, preferred value company_id: int of company.id, only used if credit_id not set. returns true of a record was deleted. delete_location Deletes a record from the location side. Required request variables: location_id location_class_id One of: credit_id (preferred) company_id (as fallback) Returns true if a record was deleted. False otherwise. delete_bank_account Deletes a bank account Requires: entity_id bank_account_id Returns true if a record was deleted, false otherwise. get_history Retrieves customer/vendor purchase. Search Criteria name: search string for company name contact_info: Search string for contact info, can match phone, fax, or email. salesperson: Search string for employee name in the salesperson field notes: Notes search. Not currently implemented meta_number: Exact match for customer/vendor number address_line: Search string for first or second line of address. city: Search string for city name state: Case insensitive, otherwise exact match for state or province zip: leading match for zip/mail code country_id: integer for country id. Exact match tartdate_from: Earliest date for startdate of entity credit account startdate_to: Lates date for entity credit accounts' start date type: either 'i' for invoice, 'o' for orders, 'q' for quotations from_date: Earliest date for the invoice/order to_date: Latest date for the invoice/order Unless otherwise noted, partial matches are sufficient. Control variables: inc_open: Include open invoices/orders. If not true, no open invoices are displayed inc_closed: Include closed invoices/orders. If not true, no closed invoices are displayed report_type: Either summary or detail returns a list of rows of the summary report and sets these to @{$self->{history_rows}} save_credit This method saves the credit account for the company. Expected inputs: credit_id (int): (Optional) Id for the account entity_class (int): Class of the account, required (1 = vendor, 2 = customer) entity_id (int): ID of entity to attach to. description (text): Description of account discount (numeric): Early payment discount taxincluded (bool): Whether prices include tax. creditlimit (numeric): Credit limit discount_terms (int): How many days can elapse before the discount lapses too. terms (int): How many days can lapse before the invoice is overdue. meta_number (varchar): Account string identifier for the account. business_id (int): ID for business type. language (varchar): Language code for invoices. pricegroup_id (int): Price group curr (char): Currency identifier, three characters long. startdate (date): Date of the start of the relationship. enddate (date): Date of the end of the relationship. threshold (NUMERIC): How much must be owed before the invoices can be paid. ar_ap_account_id (int): ID of ar/ap account. REQUIRED cash_account_id (int): ID of cash account (Optional) pay_to_name (text): Name to pay to or receive from. taxform_id (int); ID of tax form save_location This method saves an address for a company. Requires the following variables on the object: credit_id location_id location_class (1 = billing, 2 = shipping, 3 = sales) line_one line_two city state (can hold province info) mail_code (zip or postal code) country_code (ID of country) get_credit_id This method returns the current credit id from the screen. Requires entity_id, meta_number, and entity_class be set. get_metadata() This retrieves various information vor building the user interface. Among other things, it sets the following properties: $self->{ar_ap_acc_list} = qw(list of ar or ap accounts) $self->{cash_acc_list} = qw(list of cash accounts) $self->{entity_classes} = qw(list of entity classes) $self->{all_taxes} =qw(list of taxes) save_contact Saves a contact. Requires credit_id, contact_class, description, and contact to be set. Requires the following be set: credit_id or entity_id contact_class description contact old_contact old_contact_class save_bank_account Saves a bank account. Requires the following be set: entity_id bic (bank id) iban (account number) bank_account_id (id for record, optional) save_notes Saves notes. The following must be set: credit_id: credit account to annotate. Must be set to annotate credit account entity_id: entitity to annotate. note: Note contents subject: Note subject search Searches for matching company records. Populates $self->{search_results} with records found. Search criteria and inputs: account_class: required (1 for vendor, 2 for customer, etc) contact contact_info meta_number address city state mail_code country date_from date_to business_id legal_name control_code Account class may not be undef. meta_number is an exact match, as is control_code. All others specify ranges or partial matches. get_billing_info Requires that the id field is set. Sets the following: legal_name meta_number control_code tax_id street1 street2 street3 city state mail_code country accounts Returns all accounts, and sets these to $self->{accounts}. id and entity_class must be set. address($id) Returns the location if it is specified by the $id argument. get Retrieves a company record and all info. taxform_list is set to a list of tax forms for the entity's country credit_list is set to a list of credit accounts locations is set to a list of locations contacts to a list of contacts notes to a list of notes bank_account to a list of bank accounts get_pricematrix This routine gets the price matrix for the customer or vendor. The pricematrix info is stored in the pricematrix hash entry. If a customer (account_class=1), it also populates a pricematrix_pricegroup entry. delete_pricematrix($entry_id) This deletes a pricematrix line identified by $entry_id save_pricematrix Updates or inserts the price matrix. COPYRIGHT
Copyright (c) 2009, the LedgerSMB Core Team. This is licensed under the GNU General Public License, version 2, or at your option any later version. Please see the accompanying License.txt for more information. perl v5.14.2 2012-03-25 LedgerSMB::DBObject::Company(3pm)
All times are GMT -4. The time now is 07:54 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy