- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- calculation date
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
Forums
Discussions
Discussions
Discussions
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
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-19-2005 01:39 AM
03-19-2005 01:39 AM
calculation date
i want to make a date calculation.
i have database informix with column include
the date (seconds from first january 1970).
when i get the value from this column .the result like that
------------------
856775871
845717763
938508910
938508912
-------------------
how can convert this integer values to date?
thankx
- Tags:
- date arithmetic
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-19-2005 01:54 AM
03-19-2005 01:54 AM
Re: calculation date
live free or die
harry d brown jr
- Tags:
- strftime
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-19-2005 03:23 AM
03-19-2005 03:23 AM
Re: calculation date
hmm - looks like old files to me, but try this:
# NUMBER=856775871
# echo 0d$NUMBER=Y|adb
which gives the result shown below on my system. It will probably give a different result on yours as the TZ value is added to the time:
1997 Feb 24 10:17:51
regards,
John K.
- Tags:
- adb
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-19-2005 10:46 PM
03-19-2005 10:46 PM
Re: calculation date
to change the valeus to date you can use the command one by one:
#ctime 856775871
Mon Feb 24 10:17:51 1997
#ctime 845717763
Sat Oct 19 11:36:03 1996
#ctime 938508910
Tue Sep 28 10:55:10 1999
#ctime 938508912
Tue Sep 28 10:55:12 1999
Than you can create a script to do it automatically for all values.
Taulant
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-19-2005 11:22 PM
03-19-2005 11:22 PM
Re: calculation date
you can create the script changetime.sh
like below:
Example:
if you have the file data.txt in home directory like below:
------------------------------
#cat data.txt
856775871
845717763
938508910
938508912
---------------------------
---------------------------
#cat changetime.sh
#!/usr/bin/sh
while read line
do ctime $line | tee $HOME/dataout.date
done<$HOME/data.txt
---------------------------
#chmod 744 changetime.sh
---------------------------
Run the script:
#changetime.sh
Mon Feb 24 10:17:51 1997
Sat Oct 19 11:36:03 1996
Tue Sep 28 10:55:10 1999
Tue Sep 28 10:55:12 1999
-----------------------------
The script read line by line the file data.txt and run the command ctime for each line than the output is redirected to screen and even in the file dataout.date
---------------------------
#cat dataout.date
Mon Feb 24 10:17:51 1997
Sat Oct 19 11:36:03 1996
Tue Sep 28 10:55:10 1999
Tue Sep 28 10:55:12 1999
--------------------------------
Taulant
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-20-2005 08:31 PM
03-20-2005 08:31 PM
Re: calculation date
but when i tryed command
-----------------
ctime 891712421
-----------------
error appear: sh: ctime: not found
why ctime dosen't work with me
i login with root user
thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-20-2005 08:54 PM
03-20-2005 08:54 PM
Re: calculation date
Create a directory.
# mkdir /tmp/time
# vi time.c
main(argc, argv)
int argc;
char **argv;
{
time_t foo;
foo = atoi(argv[1]);
printf("%s",ctime(&foo));
}
# cc time.c
this will create a file called a.out
# ./a.out 891712421
Sat Apr 4 19:53:41 1998
Regards,
Robert-Jan
- Tags:
- ctime
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-21-2005 01:58 AM
03-21-2005 01:58 AM
Re: calculation date
perl -e 'print scalar localtime(856775871)'
- Tags:
- Perl