eHow launches Android app: Get the best of eHow on the go.

How To

How to Use Date to Display or Change the Date and Time

Contributor
By eHow Contributing Writer
(0 Ratings)

One of the most common Linux commands that most users will need to know is "date." Date is used to display or change the date and time. It is relatively easy to use and will probably be seen much more frequently than many other commands.

Difficulty: Easy
Instructions

Things You'll Need:

  • Linux manual

    Use Date to Change or Display Date and Time

  1. Step 1

    Use "--date=STRING" to display and print times that are different than the time right now. The STRING you specify can display dates and times previous ("ago"), in the future ("next") and can show months, time zones and other options.

  2. Step 2

    Process many dates with the "-f" function. This is the DATEFILE tool and can save a lot of time while using standard input.

  3. Step 3

    Use "-r" to see when date and time were last modified.

  4. Step 4

    Set your system to Coordinated Universal Time with the "-u" function.

  5. Learn Common Ways Date Is Used to Display and Change Date and Time

  6. Step 1

    Print Wednesday's date on Friday by entering this command:
    date--date="2 days ago"

  7. Step 2

    Print the date that is two weeks and three days from now by entering this command:
    date--date="two weeks three days"

  8. Step 3

    Display and print the date of Saint Patrick's Day this year by inputting this function:
    date--date='17 March +%'. A full list of these Format controls, like percent, can be found on Webtools (see Resources below).

  9. Step 4

    Change your systems date and time using this command:
    date--set='year-date time marker"
    For example, if you set your system's date and time at 10:07 in the morning on July 3 of this year, it would look like this:
    date--set="2007-7-3 10:07 AM"

  10. Step 5

    Set a slow running clock ahead by five minutes using this format:
    date--set='+5 minutes'

  11. Step 6

    Remember that when creating an argument relevant to setting time, you must limit your input to numbers only. You will want to use a two-digit month (MM), two-digit day (DD), two-digit hour (HH) and two-digit minute (MM).

Tips & Warnings
  • Review the Linux manual for the many symbols you will need to use to coordinate dates and times.
  • Adjusting your system's time or date may not be as straight forward as you might think. While the commands themselves are not especially difficult, the right to set a system clock is usually reserved for a few people in the organization. This keeps the entire company in sync and keeps different terminals from showing different times and dates.

Comments  

mmmmna said

Flag This Comment

on 9/3/2007 Oops, pardon me.... SLP 9.2/9.3... typing too fast.

mmmmna said

Flag This Comment

on 9/3/2007 1] tip and warning: WHICH linux manual? Man DATE? Or are you thinking the manual that came in your boxed set?
2] This method was not allowed in SuSe Linux Professional, in the 2.x series. You had to use a different program in those versions. Oh yeah... you had to be root as well.

mmmmna said

Flag This Comment

on 9/3/2007 1] tip and warning: WHICH linux manual? Man DATE? Or are you thinking the manual that came in your boxed set?
2] This method was not allowed in SuSe Linux Professional, in the 2.x series. You had to use a different program in those versions. Oh yeah... you had to be root as well.

Subscribe

Post a Comment

Post a Comment

Related Ads

  • Have you done this? Click here to let us know.
I Did This
Get Free Computers Newsletters

Copyright © 1999-2009 eHow, Inc. Use of this web site constitutes acceptance of the eHow Terms of Use and Privacy Policy .   en-US Portions of this page are modifications based on work created and shared by Google and used according to terms described in the Creative Commons 3.0 Attribution License. † requires javascript

eHow Computers
eHow_eHow Technology and Electronics