Skip to content

Make Selenium Easy

And Keep It That Way

  • Home
  • Share
  • Toggle search form

Linux Basic Commands – date

Posted on 02/19/2025 By admin

As a part of the Linux basic commands series, in this post, we will learn one of the very basic and frequently used commands – date.

You may not have a Linux flavored system for practicing Linux commands. Do not worry as you can use any online Linux terminals. Refer to this post to choose one.

I am using Webminal. Register yourself and access a Linux terminal for learning.

Please note Linux commands are case sensitive and always use lower case for commands. “date” and “Date” are not the same. The usage of the “date” command is as below:-

“OPTION” and “FORMAT” both are optional. Some of mostly used options are as below:-

–date=STRING -> displays time described by STRING

–set=STRING -> Set time described by STRING

“date” command gives you the current time with the day of the week followed by the date, time with timezone, and year. I am in IST Timezone but the Linux online editor which I am using is configured in CET timezone. This is the reason we see CET not IST.

You need to use a format %Z with a date. To use any format with “date” command we need to use + sign.

TZ is an environment variable that specifies the timezone. If you want to set IST timezone then use a command as shown below:-

use “reset TZ” command.

We can directly print time for different timezone without setting and unsetting as below:-

You need to use English words “tomorrow” and “yesterday” with an option “–date” to get dates as below.

Similarly, you need to use other English words to get a date after or previous year/s, month/s, or day/s, second/s, etc as shown below.

To use past dates add “ago” and for future dates do not add any extra word. If we do not add the word “ago” it means you are looking for a future date. “10 second” and “10 seconds” both are fine.

To set time use below command. Since I am using an online Linux editor where I am not allowed to set time.

There are many formats provided by date command. You can get all available formats by using “date –h” command. I will give some examples below:-

Please not here that to use multiple formats of date, do not use + sign for each format.

You can always use “date –h” command to learn more about it.

You can subscribe to my YouTube channel RetargetCommon to learn from video tutorials.

If you have any doubt, feel free to comment below.If you like my posts, please like, comment, share and subscribe.#ThanksForReading

#HappyLearning

Uncategorized

Post navigation

Previous Post: get
Next Post: REST Assured Tutorial 60 – Learn to write JsonPath expressions or JsonPath syntax

Related Posts

December 20, 2018 – Make Selenium Easy Uncategorized
TestNG Tutorials 55: DataProvider in TestNG – Lazy Initialisation of DataProvider Method – Use of Iterator Return Type | Make Selenium Easy Uncategorized
TestNG Tutorials 39: Run Only Test From a TestNG Class Without Using TestNG XML? Uncategorized
Postman Tutorial Part 32 – Retrieve Query Parameter Value in Tests Script in Postman Uncategorized
Postman tutorial Uncategorized
Interview Experience at Home Credit India – Gurgaon for Automation Testing Profile – Nov– 2019 Uncategorized

Recent Posts

  • Getting Started with Selenium 4: What Is New and How to Upgrade from Selenium 3
  • Manual Testing
  • Baby Steps To Become Efficient Selenium-Java Automation Tester
  • Features of Selenium 4.0.0 Release – Java Binding
  • Part 1: Handling Drop-down Created Using SELECT Tag In Selenium

Recent Comments

No comments to show.

Archives

  • April 2026
  • April 2025
  • March 2025
  • February 2025
  • January 2025
  • December 2024
  • November 2024
  • October 2024
  • September 2024
  • August 2024
  • April 2024
  • March 2024
  • February 2024
  • December 2023
  • October 2023
  • August 2023
  • November 2022
  • September 2022
  • August 2022
  • July 2022
  • May 2022
  • March 2022
  • October 2021
  • April 2021
  • March 2021
  • January 2021
  • December 2020
  • October 2020
  • September 2020
  • August 2020
  • June 2020
  • May 2020
  • April 2020
  • March 2020
  • February 2020
  • January 2020
  • December 2019
  • November 2019
  • October 2019
  • September 2019
  • August 2019
  • May 2019
  • December 2018
  • November 2018
  • October 2018
  • September 2018
  • August 2018
  • July 2018
  • January 2018

Categories

  • Getting Started
  • Uncategorized

Copyright © 2026 Make Selenium Easy.

Powered by PressBook Masonry Dark