# How to set the date?



## aurora (Aug 24, 2011)

Hello

So basic it might sound but I can't set the date of my FreeBSD 8.2. 
`# date`

returns 
	
	



```
Mon Feb 28 13:55:26 EET 1994
```

I've tried many samples given on the Internet and on date(1) but still I can't change the date to 24.08.2011. The timezone I selected on sysinstall was Region: 8-Europe and Country: 47-Turkey. (Does the abbreviation EET look reasonable: YES)
`# date 20110824 (2011 08 24 is meant)`
`# date 21110824 (21th centruy Year 11 Month 08 Day 24 is meant)`
`# date 20110824151515 (same as two above with time 15:15:15)`
`# date 21110824151515 (same as two above with time 15:15:15)` 

all returned illegal time format error.

How to set the date? I need to set the date correctly to download some updates for Ports collection.


----------



## SirDice (Aug 24, 2011)

What I usually do is set the time reasonably correct in the BIOS (it's the easiest way). Once the system is up and running I use ntpdate(8) to sync it with my ISP's NTP server. I then configure ntpd(8) or install net/openntpd (the latter has some extra options).


----------



## aurora (Aug 24, 2011)

Hey, that's fine. After I changed it in BIOS, the date finally started to show the correct date. 

The inability to use date command and having to use the BIOS is a bit tricky, I must say.

Thanks.


----------



## SirDice (Aug 24, 2011)

aurora72 said:
			
		

> The inability to use date command and having to use the BIOS is a bit tricky, I must say.


I agree. But like you, I can never seem to remember the correct syntax for the date command


----------



## wblock@ (Aug 24, 2011)

From the man page:

```
date [-jnu] [[[[[cc]yy]mm]dd]HH]MM[.ss]
```

Note the lack of brackets around MM; it's not optional.  Setting the year-month-day without hours and minutes appears to not be supported.  I'd guess that's due to the difficulty of interpreting what the input means without requiring at least one fixed field.


----------



## SirDice (Aug 24, 2011)

It might be nice if tzsetup(8) could also set the time and date, instead of only setting the timezone.


----------



## alphachi (Aug 31, 2011)

I think using the command [cmd=]ntpdate pool.ntp.org[/cmd] is a better idea.


----------



## SirDice (Aug 31, 2011)

alphachi said:
			
		

> I think using the command [cmd=]ntpdate pool.ntp.org[/cmd] is a better idea.



If your ISP has an NTP server it's best if you pick that one.


----------



## DutchDaemon (Aug 31, 2011)

I personally wouldn't trust any *.pool.ntp.org with ntpdate. I've seen servers jump all over the time scale because of ill-configured pool members. Either use your ISP's or their upstream's servers, or even one of the Microsoft ones. Lots of university NTP servers are public as well.


----------

