karthikeya Boyini

karthikeya Boyini

1,421 Articles Published

Articles by karthikeya Boyini

Page 17 of 143

Long Time ("T") Format Specifier in C#

karthikeya Boyini
karthikeya Boyini
Updated on 11-Mar-2026 496 Views

The Long Time format specifier represents a custom date and time format string.It is defined by DateTimeFormatInfo.LongTimePattern property.The custom format string.HH:mm:ssExampleusing System; using System.Globalization; class Demo {    static void Main() {       DateTime date = new DateTime(2018, 9, 9, 8, 15, 30);       Console.WriteLine(date.ToString("T", CultureInfo.CreateSpecificCulture("en-us")));    } }Output8:15:30 AM

Read More

What is the IsFixedSize property of Hashtable class in C#?

karthikeya Boyini
karthikeya Boyini
Updated on 11-Mar-2026 133 Views

Use the isFixedSize property of Hashtable class to get a value indicating whether the Hashtable has a fixed size.The following is an example showing how to work with IsFixedSize property.Exampleusing System; using System.Collections; namespace Demo {    class Program {       static void Main(string[] args) {          Hashtable ht = new Hashtable();          ht.Add("D01", "Finance");          ht.Add("D02", "HR");          ht.Add("D03", "Operations");          Console.WriteLine("IsFixedSize = " + ht.IsFixedSize);          Console.ReadKey();       }    } }OutputIsFixedSize = FalseAbove we have ...

Read More

Display hour with SimpleDateFormat(“H”) in Java

karthikeya Boyini
karthikeya Boyini
Updated on 11-Mar-2026 517 Views

To work with SimpleDateFormat class in Java, import the following package.import java.text.SimpleDateFormat;Now, set the format with SimpleDateFormat(“H”) to display hour in a day.Format f = new SimpleDateFormat("H");Now, get the hour −String strHour = f.format(new Date());The following is an example −Exampleimport java.text.Format; import java.text.SimpleDateFormat; import java.util.Date; import java.util.Calendar; public class Demo { public static void main(String[] args) throws Exception { // displaying current date and time Calendar cal = Calendar.getInstance(); SimpleDateFormat simpleformat = new SimpleDateFormat("dd/MMMM/yyyy hh:mm:s"); ...

Read More

octdec() function in PHP

karthikeya Boyini
karthikeya Boyini
Updated on 11-Mar-2026 96 Views

The octdec() function converts octal to decimal.Syntaxoctdec(val)Parametersval − the octal string to convertReturnThe octdec() function Returns the decimal equivalent of the specified octal number.ExampleOutputa80ExampleLet us see another example −Output120170

Read More

Left pad an integer in Java with zeros

karthikeya Boyini
karthikeya Boyini
Updated on 11-Mar-2026 3K+ Views

Let us see an example first to understand how an integer looks with left padding −888 //left padding with spaces 0000000999 //left padding with 7 zerosLet us see an example to left pad a number with zero −Examplepublic class Demo {    public static void main(String[] args) {       int val = 9899;       System.out.println(String.format("%05d",val));    } }Output09899Let us see another example that pads a greater number of zeros −Examplepublic class Demo {    public static void main(String[] args) {       int val = 9899;       System.out.println(String.format("%010d", val));    } }Output0000009899

Read More

Display minutes with SimpleDateFormat('mm') in Java

karthikeya Boyini
karthikeya Boyini
Updated on 11-Mar-2026 1K+ Views

To work with SimpleDateFormat class in Java, import the following package.import java.text.SimpleDateFormat;Now, set the format with SimpleDateFormat(“mm”) to display minutes in two-digits.Format f = new SimpleDateFormat(‘”mm”);Now, get the minutes in a string.String strMinute = f.format(new Date());The following is an example −Exampleimport java.text.Format; import java.text.SimpleDateFormat; import java.util.Date; import java.util.Calendar; public class Demo { public static void main(String[] args) throws Exception { // displaying current date and time Calendar cal = Calendar.getInstance(); SimpleDateFormat simpleformat = new SimpleDateFormat("dd/MMMM/yyyy hh:mm:s"); ...

Read More

pow() function in PHP

karthikeya Boyini
karthikeya Boyini
Updated on 11-Mar-2026 247 Views

The pow() function Returns a raised to the power of b.Syntaxpow(a,b)Parametersa − The baseb − The exponentReturnThe pow() function Returns a raised to the power of b.ExampleOutput243ExampleLet us see another example −Output4096-5.0805263425291E-5ExampleLet us see another example −OutputNAN

Read More

Format Calendar with String.format() in Java

karthikeya Boyini
karthikeya Boyini
Updated on 11-Mar-2026 1K+ Views

Firstly, consider an object with date value.Object arrObj[] = { "Date", Calendar.getInstance() };After that, use the String.format() method to format Calendar and display the date.The following is an example.Exampleimport java.util.Calendar; public class Demo {    public static void main(String []args){       Object arrObj[] = { "Date", Calendar.getInstance() };       System.out.println("Formatting Date...");       System.out.println(String.format("%1$s = %2$tY %2$tm %2$te", arrObj));    } }OutputFormatting Date... Date = 2018 11 17

Read More

Make the first letter caps and the rest lowercase in Java

karthikeya Boyini
karthikeya Boyini
Updated on 11-Mar-2026 1K+ Views

The following is an example −Examplepublic class Demo {    public static void main(String[] args) {       String str = "laptop";       System.out.println("Original String = " +str);       // letter one       String strOne = str.substring(0,1).toUpperCase();       // remaining letters       String strTwo = str.substring(1).toLowerCase();       System.out.println("Resultant String = "+strOne + strTwo);    } }OutputOriginal String = laptop Resultant String = Laptop

Read More

Java Program to get full day name

karthikeya Boyini
karthikeya Boyini
Updated on 11-Mar-2026 5K+ Views

To display the full day name, use the SimpleDateFormat(“EEEE”) as shown below −// displaying full-day name f = new SimpleDateFormat("EEEE"); String str = f.format(new Date()); System.out.println("Full Day Name = "+str);Since, we have used the Format and SimpleDateFormat class above, therefore import the following packages. With that, we have also used the Date.import java.text.Format; import java.text.SimpleDateFormat; import java.util.Date;Exampleimport java.text.Format; import java.text.SimpleDateFormat; import java.util.Date; import java.util.Calendar; public class Demo {    public static void main(String[] args) throws Exception {       // displaying current date and time       Calendar cal = Calendar.getInstance();       SimpleDateFormat simpleformat = new ...

Read More
Showing 161–170 of 1,421 articles
« Prev 1 15 16 17 18 19 143 Next »
Advertisements