- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: How to convert number of seconds in to date OR...
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
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
тАО06-11-2001 05:38 PM
тАО06-11-2001 05:38 PM
I am trying to write some scripts for ITO and see the date and time of the message received and compare it with the local time. if the message is sitting there for more than 30 mins I want to generate some alerts for operatiors.
This date filed in the IT/O database is in the form of seconds. It stores the date in number of seconds Since 1st Jan 1970. It means the current entry will be (60 * 60 min * 24 Hr * 365 days* 31 yrs ) seconds OR something similar
.
looks strange isn't it.... Well.. IT/O must be running some commands to calculate this seconds to date before displaying it on the message browser.
I want to know how can convert these seconds in to date so that I can compare it with current date and time. what commands I can use to get the current date in to number of seconds OR seconds available in the database in to date format
Thanks for your time
Cheers,
Manju
Solved! Go to Solution.
- Tags:
- date arithmetic
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-11-2001 07:24 PM
тАО06-11-2001 07:24 PM
Re: How to convert number of seconds in to date OR vice versa
Check out this URL http://www.oase-shareware.org/shell/links/index.html#archives scan for timeinseconds
Hope it helps!
Dave
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-11-2001 07:32 PM
тАО06-11-2001 07:32 PM
Re: How to convert number of seconds in to date OR vice versa
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-12-2001 01:36 AM
тАО06-12-2001 01:36 AM
Re: How to convert number of seconds in to date OR vice versa
You can do that with a small part of C code (
see at the end to have an example). You can
use some C functions to do this (man ctime to
have all informations needed).
Compile with : cc
And start with : ./a.out
#include
main (nargs,args)
int nargs;
char ** args;
{
/* Here you translate args 1 : first time entered in seconds */
time_t my_time1 = atoi (args[1]);
/* Here you translate args 2 : second time entered in seconds */
time_t my_time2 = atoi (args[2]);
/* Now you can display dates using local time parameters like timezone,
summer time,... */
printf ("\nThe first date in parameter is : %s\n",asctime (localtime (&my_time1)));
printf ("\nThe second date in parameter is : %s\n",asctime (localtime (&my_time2)));
}
Bye,
Herve
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-13-2001 03:48 AM