AmitDiwan has Published 10744 Articles

Find the difference between current date and the date records from a MySQL table

AmitDiwan

AmitDiwan

Updated on 10-Dec-2019 05:44:06

337 Views

To find the difference, use the DATEDIFF() method. Let us first create a table −mysql> create table DemoTable1446    -> (    -> DueDate date    -> ); Query OK, 0 rows affected (1.42 sec)Insert some records in the table using insert command −mysql> insert into DemoTable1446 values('2019-01-21'); Query OK, ... Read More

Set conditions in a MySQL stored procedure

AmitDiwan

AmitDiwan

Updated on 10-Dec-2019 05:40:40

734 Views

To set conditions in a stored procedure, use IF...ELSE in MySQL. Following is the syntax for if-else −IF yourCondition then       yourStatement1,  ELSE           yourStatement2,  END IF;Let us implement the above syntax in a stored procedure −mysql> DELIMITER // mysql> CREATE PROCEDURE IF_ELSE_DEMO(IN value ... Read More

How to get string as date in MySQL with dates as dot format specifier?

AmitDiwan

AmitDiwan

Updated on 10-Dec-2019 05:33:38

443 Views

To get string as date, use STR_TO_DATE() method. Let us first create a table −mysql> create table DemoTable1445    -> (    -> AdmissionDate varchar(20)    -> ); Query OK, 0 rows affected (0.46 sec)Insert some records in the table using insert command −mysql> insert into DemoTable1445 values('01.10.2019'); Query OK, ... Read More

Capacity of a SortedList in C#

AmitDiwan

AmitDiwan

Updated on 09-Dec-2019 06:27:26

167 Views

To get the capacity of a SortedList, the code is as follows −Example Live Demousing System; using System.Collections; public class Demo {    public static void Main(String[] args){       SortedList sortedList = new SortedList();       sortedList.Add("A", "1");       sortedList.Add("B", "2");       sortedList.Add("C", "3"); ... Read More

Check whether the Unicode character is a separator character in C#

AmitDiwan

AmitDiwan

Updated on 09-Dec-2019 06:24:15

250 Views

To check whether the Unicode character is a separator character, the code is as follows −Example Live Demousing System; public class Demo {    public static void Main(){       bool res;       char val = ', ';       Console.WriteLine("Value = "+val);       res ... Read More

Convert Decimal to equivalent 8-bit unsigned integer in C#

AmitDiwan

AmitDiwan

Updated on 09-Dec-2019 06:21:28

283 Views

To convert the value of the specified Decimal to the equivalent 8-bit unsigned integer, the code is as follows −Example Live Demousing System; public class Demo {    public static void Main(){       Decimal val1 = 6.59m;       Decimal val2 = 30.12m;       Decimal val3 ... Read More

Get the TypeCode for value type Decimal in C#

AmitDiwan

AmitDiwan

Updated on 09-Dec-2019 06:15:28

174 Views

To get the TypeCode for value type Decimal, the code is as follows −Example Live Demousing System; public class Demo {    public static void Main(){       Decimal val = Decimal.MaxValue;       Console.WriteLine("Decimal Value = {0}", val);       Console.WriteLine("HashCode = {0}", (val.GetHashCode()) );     ... Read More

Get the hash code for the current Decimal instance in C#

AmitDiwan

AmitDiwan

Updated on 09-Dec-2019 06:11:04

152 Views

To get the hash code for the current Decimal instance, the code is as follows −Example Live Demousing System; public class Demo {    public static void Main(){       Decimal val = 135269.38193M;       Console.WriteLine("Decimal Value = {0}", val);       Console.WriteLine("HashCode = {0}", (val.GetHashCode()) ); ... Read More

Convert the specified string representation of a logical value to its Boolean equivalent in C#

AmitDiwan

AmitDiwan

Updated on 09-Dec-2019 06:08:28

112 Views

To convert the specified string representation of a logical value to its Boolean equivalent, the code is as follows −Example Live Demousing System; public class Demo {    public static void Main(){       bool val;       bool flag;       val = Boolean.TryParse("true", out flag);   ... Read More

Convert the value of the current DateTime object to UTC in C#

AmitDiwan

AmitDiwan

Updated on 09-Dec-2019 06:03:43

2K+ Views

To convert the value of the current DateTime object to Coordinated Universal Time (UTC), the code is as follows −Example Live Demousing System; public class Demo {    public static void Main() {       DateTime d = new DateTime(2019, 12, 11, 7, 11, 25);       Console.WriteLine("Date = ... Read More

Advertisements