GreenLake Administration
- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: Date×tamp use in scripts
Operating System - HP-UX
1847942
Members
3405
Online
104021
Solutions
Forums
Categories
Company
Local Language
back
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Forums
Discussions
back
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
Discussion Boards
Blogs
Information
Community
Resources
Community Language
Language
Forums
Blogs
Topic Options
- 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
07-28-2000 05:29 AM
07-28-2000 05:29 AM
Date×tamp use in scripts
I want to use a date variable in a (crontab-script to monitor performance of our AutoRAID 12h system (arraydsp -r and arraydsp -m).
The required dates are the current date and timestamp as well as the same variable from an earlier period.
The required format is mmddhhmm (month, day, hour, minutes). I can get date + time with the date +%m%d%H%M command but have to gave an older time and date as well.
How can I perform a calculation using date to get, for example, the current date and time minus six hours.
The required dates are the current date and timestamp as well as the same variable from an earlier period.
The required format is mmddhhmm (month, day, hour, minutes). I can get date + time with the date +%m%d%H%M command but have to gave an older time and date as well.
How can I perform a calculation using date to get, for example, the current date and time minus six hours.
3 REPLIES 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-28-2000 05:40 AM
07-28-2000 05:40 AM
Re: Date×tamp use in scripts
Hi,
i think this job goes only with a little C programm. I put it at the attachment.
Save the C source into pasttime.c and compile with cc pasttime.c -o pasttime
Usage: pasttime
The output is what you want to get for arraydsp.
Cheers
Andrew
i think this job goes only with a little C programm. I put it at the attachment.
Save the C source into pasttime.c and compile with cc pasttime.c -o pasttime
Usage: pasttime
The output is what you want to get for arraydsp.
Cheers
Andrew
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-28-2000 05:41 AM
07-28-2000 05:41 AM
Re: Date×tamp use in scripts
The (not so) easy way is to convert your date/times to binary seconds, do your arithmetic and then convert them back to date/time.
How is your C programming? man ctime gives details on the functions that you need (localtime, time etc).
If C is not your forte, it could also be done in Perl.
Regards,
John
How is your C programming? man ctime gives details on the functions that you need (localtime, time etc).
If C is not your forte, it could also be done in Perl.
Regards,
John
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-28-2000 05:45 AM
07-28-2000 05:45 AM
Re: Date×tamp use in scripts
DAY=`TZ=MST+17MDT date +%d%H%M`
Will give previous 24 hrs hours in MST. You will have to play with and modify your TZ
value.
Will give previous 24 hrs hours in MST. You will have to play with and modify your TZ
value.
The opinions expressed above are the personal opinions of the authors, not of Hewlett Packard Enterprise. By using this site, you accept the Terms of Use and Rules of Participation.
Company
Events and news
Customer resources
© Copyright 2026 Hewlett Packard Enterprise Development LP