Articles on Trending Technologies

Technical articles with clear explanations and examples

How to manipulate Date in PowerShell?

Chirag Nagrekar
Chirag Nagrekar
Updated on 20-Mar-2020 2K+ Views

To add/remove date from the date string you need to use AddDay() method. For example,We need to add 6 days to the current date.(Get-Date).AddDays(6) 25 March 2020 22:40:36To go back to the specific number of days, the same AddDays() method will be used but the numbers are negative. For example,(Get-Date).AddDays(-6) 13 March 2020 22:45:34

Read More

What are the components in a module-info file in Java 9?

raja
raja
Updated on 20-Mar-2020 2K+ Views

A module is an independent unit of application that represents a single functionality. A module contains three important componentsName: To uniquely identify itDependencies: Other modules in which it depends onExported packages: Packages which are open for external applicationIn order to declare a module, we need to add the "module-info.java" file to the root source code. The components of the "module-info.java" file includes "name", "requires", "exports", and "exports to".Below is the template of "module-info.java" filemodule {    requires ;    requires ;    ...    exports ;    exports ;    ...    exports to ; }Name: It is ...

Read More

How to format date string in PowerShell?

Chirag Nagrekar
Chirag Nagrekar
Updated on 20-Mar-2020 4K+ Views

By default the when you run the (Get-Date) cmdlet, its output is in the below format.PS C:\WINDOWS\system32> Get-Date 18 March 2020 22:56:18You can format the above output in the various format supported by PowerShell.Examplesd – Short date pattern.PS C:\WINDOWS\system32> Get-Date -Format d 18-03-2020D – Long date patternPS C:\WINDOWS\system32> Get-Date -Format D 18 March 2020f – Full date pattern with a short time pattern.PS C:\WINDOWS\system32> Get-Date -Format f 18 March 2020 23:01F – Full date pattern with a long time pattern.PS C:\WINDOWS\system32> Get-Date -Format F 18 March 2020 23:02:22g – General date pattern with a short time pattern.PS C:\WINDOWS\system32> Get-Date -Format g 18-03-2020 ...

Read More

How to check if the date is adjusted by Daylight saving time using PowerShell?

Chirag Nagrekar
Chirag Nagrekar
Updated on 20-Mar-2020 3K+ Views

To check if the date is adjusted by the daylight savings you need to use the function IsDayLightSavingTime() of the Get-Date cmdlet.PS C:\WINDOWS\system32> (Get-Date).IsDaylightSavingTime() FalseTo know more about DST, check the link below.http://www.webexhibits.org/daylightsaving/b.html

Read More

Explain Get-Date function in PowerShell.

Chirag Nagrekar
Chirag Nagrekar
Updated on 20-Mar-2020 691 Views

Get-Date function in PowerShell is to get the current system date and time. For example, when you type simply Get-Date, the output will be, Get-DatePS C:\WINDOWS\system32> Get-Date 18 March 2020 19:17:03When you check the type of the (Get-Date) function, it is DateTime.(Get-Date).GetType() PS C:\WINDOWS\system32> (Get-Date).GetType() IsPublic IsSerial    Name       BaseType -------- --------    ----       -------- True     True        DateTime    System.ValueTypeWhen you check all the properties of the (Get-Date).PS C:\WINDOWS\system32> Get-Date | fl * DisplayHint : DateTime DateTime    : 18 March 2020 19:32:32 Date        : 18-03-2020 ...

Read More

How to convert the Integer variable to the string variable in PowerShell?

Chirag Nagrekar
Chirag Nagrekar
Updated on 20-Mar-2020 36K+ Views

To convert the integer variable to the string variable, you need to use the explicit conversion or the functional method. In the below example, we are assigning an integer value to the variable $X.$x = 120 $x.GetType().NameNow when you check the data type of that variable, it will be Int32.To convert it into the string variable, first, we will use the explicit method by using a square bracket and data type to convert inside the brackets.[string]$x = 130 $x.GetType().NameThe data type of $x is the String.In the second method, you can use the PowerShell functional method ToString() to convert. For ...

Read More

How to get the variable data type in PowerShell?

Chirag Nagrekar
Chirag Nagrekar
Updated on 20-Mar-2020 82K+ Views

There are different data types exist for the variable like Byte, Int32, Float, String, etc. To get the variable type, we need to use the GetType() method.Example$x = 10 $x.GetType()OutputIsPublic IsSerial Name    BaseType -------- -------- ----    -------- True     True     Int32   System.ValueTypeTo get only the variable datatype use Name property.$x.GetType().NameInt32

Read More

How can we display all module names in Java 9?

raja
raja
Updated on 19-Mar-2020 412 Views

In Java 9, the module concept has introduced. It is a named, self-describing collection of code and data. The code can be organized as a set of packages containing types like java classes and interfaces, and data includes resources and other kinds of static information. A module contains a name, dependencies, and exported packages.Syntaxmodule com.tutorialspoint.mymodule { // some statements }In the below example, we can able to display all module names by using the ModuleLayer class.Examplepublic class AllModulesNamesTest { public static void main(String args[]) { ModuleLayer.boot().modules().forEach((module) -> { ...

Read More

How to print the pattern of stars in JShell in Java 9?

raja
raja
Updated on 19-Mar-2020 332 Views

JShell is a REPL tool introduced in Java 9 that allows us to execute Java code and getting results immediately. We can evaluate expressions or simple algorithms without creating a new project, compile or build it by using JShell. We can also execute expressions, use imports, define classes, methods, and variables. It is a part of Java 9 JDK but not JRE.We can start JShell session in command-prompt by simply typing jshell. We can use different commands: /exit to quit the JShell session, reset/reload JShell anytime by typing /reset, and /reload, /import to list the imports, etc.In the below example, ...

Read More

What are Compact Strings in Java 9?

raja
raja
Updated on 19-Mar-2020 434 Views

Since Java 9, the JVM optimizes strings by using a new feature called Compact Strings. Instead of having a char[] array, a string can be represented as a byte[] array. We can use either UTF-16 or Latin-1 to produce either one or two bytes per character. If JVM detects the string contains only ISO-8859-1/Latin-1 characters, then string uses one byte per character internally.The string can be represented with a compact string or not is detected when the string is created. This feature has enabled by default and switches off using the -XX:-CompactStrings. It doesn't revert to a char[] implementation and ...

Read More
Showing 54471–54480 of 61,297 articles
Advertisements