If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > Unix Shell Scripts > at all who want to manipulate the date

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 07-12-04, 16:21
fla5do fla5do is offline
Registered User
 
Join Date: Oct 2003
Location: Germany
Posts: 138
Smile at all who want to manipulate the date

Hi users,
at all who want to manipulate the UNIX-Date backwards or forwards.
Move the attachment to idate.sc and give x permissions to the file.
The script idate.sc works from 01.01.1900 since 31.12.2099.

On commandline insert "idate.sc dd.mm.yyyy" and you get the days since 01.01.1900.

or "idate.sc 38179" and you get the date 12.07.2004

!!!!!!!!!!! remember : the dateformat is day.month. year !!!!!!!!!!!!!!!!!
!!!!!!!!!!! ist halt aus Deutschland !!!!!!!!!!!!!!!!!

Use this Example :
############# Example 1 : 100 days backwards from today
################################################## #####
EXAMPLE=100
AKT_DATE=`date '+%d.%m.%Y'`
echo "AKT_DATE from today => "$AKT_DATE
INF_DATE=`idate.sc $AKT_DATE`
echo "Days since 01.01.1900 => "$INF_DATE
NEW_DATE=`expr $INF_DATE - $EXAMPLE`
NEW_DATE=`idate.sc $NEW_DATE`
echo "NEW_DATE "$EXAMPLE" days backwards from today => "$NEW_DATE
echo "."
echo "-------------------------------------------------"
echo "."
############# Example 2 : 100 days forwards from today
################################################## #####
EXAMPLE=100
AKT_DATE=`date '+%d.%m.%Y'`
echo "AKT_DATE from today => "$AKT_DATE
INF_DATE=`idate.sc $AKT_DATE`
echo "Days since 01.01.1900 => "$INF_DATE
NEW_DATE=`expr $INF_DATE + $EXAMPLE`
NEW_DATE=`idate.sc $NEW_DATE`
echo "NEW_DATE "$EXAMPLE" days forwards from today => "$NEW_DATE
Attached Files
File Type: txt idate.txt (4.9 KB, 224 views)
__________________
Greetings from germany
Peter F.

Last edited by fla5do; 07-12-04 at 16:27.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On