GreenLake Administration
- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- subtract Date
Operating System - HP-UX
1848284
Members
5838
Online
104024
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
11-15-2007 03:08 AM
11-15-2007 03:08 AM
subtract Date
Hi,
Iam working in HP-UX 11i env, please help me how to subtract current date minus 2 hours.
I want to display the time before 2 hours.
Thanks & Regards
Balaji
Iam working in HP-UX 11i env, please help me how to subtract current date minus 2 hours.
I want to display the time before 2 hours.
Thanks & Regards
Balaji
3 REPLIES 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-15-2007 03:12 AM
11-15-2007 03:12 AM
Re: subtract Date
Hi:
Use perl;
# perl -le 'print scalar localtime(time-(2*60*60))'
This subtracts 2-hours (in seconds) from the current date and time.
Regards!
...JRF...
Use perl;
# perl -le 'print scalar localtime(time-(2*60*60))'
This subtracts 2-hours (in seconds) from the current date and time.
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-18-2007 08:16 PM
11-18-2007 08:16 PM
Re: subtract Date
Hi,
you can look for caljd script in the forum.
HTH,
Art
you can look for caljd script in the forum.
HTH,
Art
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-18-2007 09:05 PM
11-18-2007 09:05 PM
Re: subtract Date
#include
main()
{
time_t x;
char buf[512];
time(&x);
x=x-2*3600;
strftime(buf,511,"%H:%M:%S",localtime(&x));
printf(buf);
}
in shell, but without taking DST in account:
typeset -i x
x=$(date +%H)
x=x+98
heure=${x#1}$(date +:%M:%S)
main()
{
time_t x;
char buf[512];
time(&x);
x=x-2*3600;
strftime(buf,511,"%H:%M:%S",localtime(&x));
printf(buf);
}
in shell, but without taking DST in account:
typeset -i x
x=$(date +%H)
x=x+98
heure=${x#1}$(date +:%M:%S)
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