- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Reg Previous date calculation
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-02-2004 02:48 PM
тАО03-02-2004 02:48 PM
Reg Previous date calculation
i am using the following command for calculating the previous date in hp unix server.
$(sh -c "TZ=$(date +%Z)+24; export TZ; date '+%Y%m%d'")
But it is not working now.i dont know why. so if any body plz let me know any command to calculate the prevoius date.it is very urgent to me.
Thanks in Advance
Regards,
HariKrishna
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-02-2004 02:55 PM
тАО03-02-2004 02:55 PM
Re: Reg Previous date calculation
Try the following simple script
NOW=$(/usr/contrib/bin/perl -e "printf("%d\n",time())")
(( YES = $NOW - 86400 ))
echo "0d${YES}=Y" |adb
86400 is the number of seconds since yesterday. If you want 'n' days back, then you calculate it by doing n*24*60*60
-Sri
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-02-2004 02:59 PM
тАО03-02-2004 02:59 PM
Re: Reg Previous date calculation
thanks for giving the reply.but i want the code in unix script only .
plz let me know if you know it in the unix
Thanking you
regards,
HariKrishna
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-02-2004 03:03 PM
тАО03-02-2004 03:03 PM
Re: Reg Previous date calculation
That is unix script. Perl is available in /usr/contrib/bin on any HP-UX and it is used only once to get the epoch seconds. Rest are all HP commands.
-Sri
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-03-2004 04:23 AM
тАО03-03-2004 04:23 AM
Re: Reg Previous date calculation
YESTERDAY=$(caljd.sh -s -y $(calhd.sh -p 1))
echo "Yesterday = ${YESTERDAY}"
If you like, you can yank out the cal_jdate and jdate_cal functions and use them inside your own script for a "pure" shell solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-03-2004 11:22 AM
тАО03-03-2004 11:22 AM
Re: Reg Previous date calculation
TZ=PST8PDT+24 date +%A | read Yesterday
But for a robust and solid date routine, A.Clay's has been noted by many to be the top choice.
We also use his. Shucks, now I owe royalties.
Best of luck.
Regards,
dl
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-03-2004 11:30 AM
тАО03-03-2004 11:30 AM
Re: Reg Previous date calculation
YESTERDAY=$(caljd.sh -s -y $(caljd.sh -p 1))
echo "Yesterday = ${YESTERDAY}"
Invoke as caljd.sh -u for full usage and examples.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-04-2004 01:40 AM
тАО03-04-2004 01:40 AM