# how does -f option of the  date command works?



## abhinav4987 (Jun 28, 2020)

Iam having trouble with -f option of date command, can someone please illustrate how does it works?


----------



## tingo (Jun 28, 2020)

Here:

```
tingo@kg-core2$ date -f "%D" "06/29/00"
date: bind: Permission denied
date: settimeofday (timeval): Operation not permitted
```
I don't actually want to change the date on my machine, so I'm not running it as root. :-D 
FWIW, the manual page for date(1) says you should look at  strptime(3) to find out more about the format for the '-f' parameter, if you look at the strptime man page you will be directed to strftime(3), which has the format codes.


----------



## abhinav4987 (Jun 28, 2020)

okay ,
I saw %D is a specified date format. but what purpose does 06/29/00 serves?


----------



## SirDice (Jun 29, 2020)

That's going  to be the "new_date" that's being set.


```
-f	     Use input_fmt as the format string	to parse the new_date provided
	     rather than using the default [[[[[cc]yy]mm]dd]HH]MM[.ss] format.
	     Parsing is	done using strptime(3).
```


----------

