Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using the date function to return a date a few minutes in tne future - is this possible? 2

Status
Not open for further replies.

bazil2

Technical User
Feb 15, 2010
148
DE
(Elementary user)

I am using the following syntax to get the date in various notifications:

#date(%d-%m-%y_%H:%M:%S)#

This returns for example:

18-06-12_11:33:22

My goal is to 'add' another five minutes to the output, as in: #date(%d-%m-%y_%H:%M+5:%S)#

From researching some posts, it looks possible using Pearl for example, however does anyone know if it possible only using the date command?

Best regards



 
Hi

Yes, GNU [tt]date[/tt]' [tt]-d[/tt] option is quiet versatile :
Code:
date -d 'now + 5 minutes' +'%d-%m-%y_%H:%M:%S'

[gray]# or shorter[/gray]

date -d '5min' +'%d-%m-%y_%H:%M:%S'

Feherke.
[link feherke.github.com/][/url]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top