Skip to main content
Drupal 8

Main navigation

  • Home
    • Question And Answer
    • NEWS
    • Projects
  • Tutorials - Drupal
    • Android
    • Other
User account menu
  • Log in

Breadcrumb

  1. Home

Show & Set Date and Time by Command Prompt on Linux

By editor , 20 April, 2016
Question

How to set Date and Time on Linux (redhat, debian, umuntu, mint, centos ....) using shell command prompt?

 

To show the Date / Time on Linux

date

To show the hardware Clock (RTC) on Linux

hwclock -r
OR
hwclock --show
OR show time in UTC (Coordinated Universal Time)
hwclock --show --utc

To set the Set Date and Time using shell Command

date --set="STRING"
Examples:
date -s "30 JAN 2016 12:00:00"
date --set="30 JAN 2016 12:00:00"
date +%Y%m%d -s "20160420"
date +%T -s "10:20:30"
date +%T%p -s "10:20:30AM"
date +%T%p -s "10:20:30PM"

To set the Hardware Clock (RTC) to the current System Time

hwclock --systohc
OR
hwclock -w

Tags

  • Shell
  • Linux

Comments

Plain text

  • No HTML tags allowed.
  • Lines and paragraphs break automatically.
  • Web page addresses and email addresses turn into links automatically.

Links

  • Drupal.org
  • Drupal core release cycle
  • Drupal events with ease
  • Unit test with Drupal using PHPUnit (Drupal 10)
  • Tokens for file upload url
  • Tips for Docker
  • CKEditor inline image files usage for custom forms.
  • Install Docker on Linux Mint
  • Install PHP 8.1
  • Drupal Security Best Practices
  • Order and sort items with tabledrag
  • Add a custom service YAML container
  • Apply a patch with composer