- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - Linux
- >
- Info on timestamp
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
тАО08-19-2007 10:02 PM
тАО08-19-2007 10:02 PM
Info on timestamp
Can any body tell me how to subtract the current timestamp - 3minutes.
Thanks in advance.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-19-2007 10:11 PM
тАО08-19-2007 10:11 PM
Re: Info on timestamp
...where "180" is the seconds for three minutes.
Yours
Danny Petterson
- Tags:
- Perl
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-19-2007 10:32 PM
тАО08-19-2007 10:32 PM
Re: Info on timestamp
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-19-2007 11:37 PM
тАО08-19-2007 11:37 PM
Re: Info on timestamp
2007-07-19 14:29:33
Now How to subtract the 3 minutes tht i had askd earlier.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-20-2007 12:19 AM
тАО08-20-2007 12:19 AM
Re: Info on timestamp
I suggest you to use perl:
perl -e '@x=localtime(time-3*60);printf"%4d-%02d-%02d %02d:%02d:%02d\n",$x[5]+1900,$x[4]+1,$x[3],$x[2],$x[1],$x[0]'
Regards
p.s. I have assigned points to 4 of 36 responses --> don't forget to assign points, also in your other threads!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-20-2007 01:52 AM
тАО08-20-2007 01:52 AM
Re: Info on timestamp
You can use 'date -d "
If you just wanted the current time 3 minutes ago, you could have used 'date -d "3 minutes ago"', but this doesn't work stacked onto another -d.
Unfortunately, 'date -d' doesn't understand the Epoch form of time, i.e. 'date -d 1184819193'. If it did, you could stack some date's, but it doesn't.
So, use the funky perl method. You can $() it in a subshell *shrug*.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-22-2007 06:28 PM
тАО08-22-2007 06:28 PM
Re: Info on timestamp
perl -e '@x=localtime(time-3*60);printf"%4d-%02d-%02d %02d:%02d:%02d\n",$x[5]+1900,$x[4]+1,$x[3],$x[2],$x[1],$x[0]'
with respect to
2007-07-19 14:29:33
i have assigned points and thanks.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-22-2007 06:37 PM
тАО08-22-2007 06:37 PM
Re: Info on timestamp
Do you want to take 3 minutes away from the current time, or from a pre-defined time?
If from the current time, you can use either the perl method above, or:
date -d '3 minutes ago' +'%Y-%m-%d %H:%M:%S'
But this all depends on how and where you want to use it.
For instance, if you're wanting to do this calculation to use in an SQL query, it's easier to do it *IN* SQL. The MySQL syntax would be simply:
SELECT DATE_SUB(NOW(), INTERVAL 3 MINUTE);
In other SQL's, there can be slightly different syntax.
So, can you tell us where you want to use this? Perhaps then we can give you a better answer.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-22-2007 08:35 PM
тАО08-22-2007 08:35 PM
Re: Info on timestamp
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-22-2007 10:09 PM
тАО08-22-2007 10:09 PM