Examples of GNU Date

原创 2004年09月03日 10:04:00
原文:http://www.labri.fr/Perso/~strandh/Teaching/USI/Common/Sh-utils/sh-utils_65.html
作者:David MacKenzie et al.

Examples of date

Here are a few examples. Also see the documentation for the `-d' option in the previous section.

  • To print the date of the day before yesterday:
    date --date='2 days ago'
    
  • To print the date of the day three months and one day hence:
    date --date='3 months 1 day'
    
  • To print the day of year of Christmas in the current year:
    date --date='25 Dec' +%j
    
  • To print the current full month name and the day of the month:
    date '+%B %d'
    
    But this may not be what you want because for the first nine days of the month, the `%d' expands to a zero-padded two-digit field, for example `date -d 1may '+%B %d'' will print `May 01'.
  • To print a date without the leading zero for one-digit days of the month, you can use the (GNU extension) - modifier to suppress the padding altogether.
    date -d=1may '+%B %-d'
    
  • To print the current date and time in the format required by many non-GNU versions of date when setting the system clock:
    date +%m%d%H%M%Y.%S
    
  • To set the system clock forward by two minutes:
    date --set='+2 minutes'
    
  • To print the date in the format specified by RFC-822, use `date --rfc'. I just did and saw this:
    Mon, 25 Mar 1996 23:34:17 -0600
    
  • To convert a date string to the number of seconds since the epoch (which is 1970-01-01 00:00:00 UTC), use the `--date' option with the `%s' format. That can be useful in sorting and/or graphing and/or comparing data by date. The following command outputs the number of the seconds since the epoch for the time one second later than the epoch, but in time zone five hours later (Cambridge, Massachusetts), thus a total of five hours and one second after the epoch:
    date --date='1970-01-01 00:00:01 UTC +5 hours' +%s
    18001
    
    Suppose you had not specified time zone information in the example above. Then, date would have used your computer's idea of the time zone when interpreting the string. Here's what you would get if you were in Greenwich, England:
    # local time zone used
    date --date='1970-01-01 00:00:01' +%s
    1
    
  • If you're sorting or graphing dated data, your raw date values may be represented as seconds since the epoch. But few people can look at the date `946684800' and casually note "Oh, that's the first second of the year 2000."
    date --date='2000-01-01 UTC' +%s
    946684800
    
    To convert such an unwieldy number of seconds back to a more readable form, use a command like this:
    date -d '1970-01-01 946684800 sec' +"%Y-%m-%d %T %z"
    2000-01-01 00:00:00 +0000
    

解决Finetune时 Aborted at 1493299396 (unix time) try "date -d" if you are using GNU date

在使用bvlc_reference_caffenet.caffemodel模型训练自己数据时,最开始使用Digits软件进行finetune,发现一点问题都没有,出于学习的态度,准备手动输入命令进行训...
  • fengyuejin1
  • fengyuejin1
  • 2017-05-01 22:56:50
  • 2419

caffe*** Aborted at 1457505270 (unix time) try "date -d @1457505270" if you are using GNU date ***

在自己建立新的caffe层时,出现错误:*** Aborted at 1457505270 (unix time) try "date -d @1457505270" if you are using...
  • thesby
  • thesby
  • 2016-03-13 20:44:44
  • 8572

SSD训练:*** Aborted at 1457505270 (unix time) try "date -d @1457505270" if you are using GNU date ***

在SSD训练时抛出错误:*** Aborted at 1457505270 (unix time) try "date -d @1457505270" if you are using GNU dat...
  • linyigreat
  • linyigreat
  • 2018-01-30 11:11:03
  • 116

Error: (unix time) try if you are using GNU date

Checking the current GPU devices $ nvidia-smi Mon Sep 26 18:01:53 2016 +--------------------...
  • jyl1999xxxx
  • jyl1999xxxx
  • 2017-03-05 16:03:40
  • 1672

*** Aborted at 1482144515 (unix time) try "date -d @1482144515" if you are using GNU date ***

*** Aborted at 1482144515 (unix time) try "date -d @1482144515" if you are using GNU date *** PC: @...
  • zouyu1746430162
  • zouyu1746430162
  • 2016-12-19 19:03:09
  • 3568

Caffe训练时出现Aborted ** using GNU date ** core dumped问题解决记录

1. 問題 *** Aborted at 1510023780 (unix time) try "date -d @1510023780" if you are using GNU date ***...
  • m_buddy
  • m_buddy
  • 2017-11-07 19:11:45
  • 1117

【caffe】Aborted at 1457505270 (unix time) try "date -d @1457505270" if you are using GNU date错误解决方法

caffe可能遇到的错误
  • jiajinrang93
  • jiajinrang93
  • 2017-09-21 23:29:17
  • 1138

[Caffe]:关于*** Aborted at 1479432790 (unix time) try "date -d @1479432790" 错误的另一种原因

这两天在caffe跑网络,原本的lr_policy:"step",后面更改了策略,使用lr_policy:"step"。但是却出现了如下错误:*** Aborted at 1479432790 (un...
  • cham3
  • cham3
  • 2016-11-18 10:03:35
  • 3130

google glog

glog
  • zhangla1220
  • zhangla1220
  • 2016-03-28 16:36:33
  • 707

unix date

该命令的一般格式为: date [选项] 显示时间格式(以+开头,后面接格式) date 设置时间格式命令中各选项的含义分别为: -d datestr, --date datestr 显示由dates...
  • wbj1234566
  • wbj1234566
  • 2008-03-16 10:18:00
  • 3521
收藏助手
不良信息举报
您举报文章:Examples of GNU Date
举报原因:
原因补充:

(最多只允许输入30个字)