Time and date
Encyclopedia
In computing
Computing
Computing is usually defined as the activity of using and improving computer hardware and software. It is the computer-specific part of information technology...

, time and date are commands
Command (computing)
In computing, a command is a directive to a computer program acting as an interpreter of some kind, in order to perform a specific task. Most commonly a command is a directive to some kind of command line interface, such as a shell....

 that are used to display and set the current time and date
Calendar date
A date in a calendar is a reference to a particular day represented within a calendar system. The calendar date allows the specific day to be identified. The number of days between two dates may be calculated. For example, "24 " is ten days after "14 " in the Gregorian calendar. The date of a...

 of the operating system
Operating system
An operating system is a set of programs that manage computer hardware resources and provide common services for application software. The operating system is the most important type of system software in a computer system...

. Both commands are available in DOS
DOS
DOS, short for "Disk Operating System", is an acronym for several closely related operating systems that dominated the IBM PC compatible market between 1981 and 1995, or until about 2000 if one includes the partially DOS-based Microsoft Windows versions 95, 98, and Millennium Edition.Related...

, OS/2
OS/2
OS/2 is a computer operating system, initially created by Microsoft and IBM, then later developed by IBM exclusively. The name stands for "Operating System/2," because it was introduced as part of the same generation change release as IBM's "Personal System/2 " line of second-generation personal...

 and Microsoft Windows
Microsoft Windows
Microsoft Windows is a series of operating systems produced by Microsoft.Microsoft introduced an operating environment named Windows on November 20, 1985 as an add-on to MS-DOS in response to the growing interest in graphical user interfaces . Microsoft Windows came to dominate the world's personal...

 command line interpreters (shells
Shell (computing)
A shell is a piece of software that provides an interface for users of an operating system which provides access to the services of a kernel. However, the term is also applied very loosely to applications and may include any software that is "built around" a particular component, such as web...

) such as COMMAND.COM
COMMAND.COM
COMMAND.COM is the filename of the default operating system shell for DOS operating systems and the default command line interpreter on Windows 95, Windows 98 and Windows Me...

, cmd.exe
Cmd.exe
Command Prompt is the Microsoft-supplied command-line interpreter on OS/2, Windows CE and on Windows NT-based operating systems...

and 4DOS
4DOS
4DOS is a command line interpreter by JP Software, designed to replace the default command interpreter COMMAND.COM in DOS and Windows 95/98/Me. The 4DOS family of programs are meant to replace the default command processor. 4OS2 and 4NT replace CMD.EXE in OS/2 and Windows NT respectively...

/4NT
4NT
Take Command Console , formerly known as 4DOS for Windows NT and 4NT, is a command line interpreter by JP Software, designed as a substitute for the default command interpreter in Microsoft Windows...

. The Unix
Unix
Unix is a multitasking, multi-user computer operating system originally developed in 1969 by a group of AT&T employees at Bell Labs, including Ken Thompson, Dennis Ritchie, Brian Kernighan, Douglas McIlroy, and Joe Ossanna...

 command date
Date (Unix)
The Unix date command displays the time and date. The super-user can use it to set the system clock.- Usage :With no options, the date command displays the current date and time, including the abbreviated day name, abbreviated month name, day of the month, the time separated by colons, the timezone...

displays both the time and date, but does not allow the normal users to change either. Users with superuser
Superuser
On many computer operating systems, the superuser is a special user account used for system administration. Depending on the operating system, the actual name of this account might be: root, administrator or supervisor....

 privileges may use date -s to change the time and date. The Unix command time
Time (Unix)
time is a command in the Unix operating systems. It is used to determine the duration of execution of a particular command.-Usage:To use the command, simply precede any command by the word time, such as:time ls...

performs a different function. In Windows PowerShell
Windows PowerShell
Windows PowerShell is Microsoft's task automation framework, consisting of a command-line shell and associated scripting language built on top of, and integrated with the .NET Framework...

, date is a short form for the Get-Date Cmdlet which returns the current system time object. The Set verb of the Cmdlet is used to set both date and time.

Microsoft Windows (cmd.exe)


time [/t] [/time] [hours:[minutes[:seconds[.hundredths]]][{A|P}]]



date [/T | date]


Note: When these commands are called from the command line or a batch script, they will display the time or date and wait for the user to type a new time or date and press RETURN. The parameter '/t' will bypass asking the user to reset the time or date.

The format of the date parameter is dependent upon regional settings.

4DOS/4NT


TIME [/T] [hh[:mm[:ss]]] [AM | PM]

hh: The hour (0 - 23).
mm: The minute (0 - 59).
ss: The second (0 - 59), set to 0 if omitted.

/T: (display only)



DATE [/T] [mm-dd-yy]

/T: (Display only)
mm: The month (1 - 12).
dd: The day (1 - 31).
yy: The year (00 - 99, or a 4-digit year).

Windows PowerShell


Get-Date Date] ] [-Year ] [-Month ]
[-Day ] [-Hour ] [-Minute ] [-Second ] ...



Set-Date [-Date] ...
Set-Date [-Adjust] ...

OS/2 (cmd.exe)


TIME [hh-mm-ss] [/N]



DATE [mm-dd-yy] or [dd-mm-yy] or [yy-mm-dd] or [yy-dd-mm]


Note: /N means no prompt for TIME. This parameter is not available in the DATE command.

Microsoft Windows (cmd.exe)

  • To set the computer clock to 3:42 P.M., either of the following commands can be used:



C:\> time 15:42
C:\> time 3:42P

  • To change the date to November 16, 1982, any of the following can be entered at the prompt:



C:\> date
11.16.82
11-16-82
11/16/82

  • To display the current system date, type the following command:



date /t

4DOS/4NT

  • Display the current system time:



C:\PROGRAM FILES\JPSOFT\4DOS>time /t
19:30:42

  • Display the system date:



C:\PROGRAM FILES\JPSOFT\4DOS>date /t
Wed 7.05.2008

Windows PowerShell

  • Adjust the current system time by -5 minutes:



PS C:\>Set-Date -Adjust (New-TimeSpan -Minutes -5)

Wednesday, May 07, 2008 7:25:42 PM

  • Return the number of days between now and a given date:



PS C:\>((date) - (date 16 November 1982)).Days
9304

  • Return the current system time and display it in a localized date and time format:



PS C:\>$culture = new-object Globalization.CultureInfo 'de-DE'
PS C:\>(date).ToString($culture)
07.05.2008 19:30:42

OS/2 (cmd.exe)

  • Display the current system time:



[C:\]time
Current time is: 3:25 PM
Enter the new time:

  • Display the system date:



[C:\]date
Current date is: Wed 2.12.2010
Enter the new date: (dd.mm.yy)
The source of this article is wikipedia, the free encyclopedia.  The text of this article is licensed under the GFDL.
 
x
OK