Samual Sam has Published 2492 Articles

DecimalFormat("00E00") in Java

Samual Sam

Samual Sam

Updated on 30-Jul-2019 22:30:24

89 Views

DecimalFormat is a concrete subclass of NumberFormat that formats decimal numbers.Let us set DecimalFormat("00E00") first.Format f = new DecimalFormat("00E00");Now, we will format a number and display the result in a string using the format() method −String res = f.format(-5977.3427);Since, we have used both Format and DecimalFormat class in Java, therefore ... Read More

MySQL CREATE USER with a variable?

Samual Sam

Samual Sam

Updated on 30-Jul-2019 22:30:24

835 Views

You can use a dynamic query for this. First set the variable name for username and variable name for a password. The syntax is as follows −SET @anyVariableName=’yourUserName’; SET @anyVariableName1=’yourpassword’;Now you can use the CONCAT() function from MySQL. The syntax is as follows −SET @yourQueryName = CONCAT ('    CREATE ... Read More

DecimalFormat("0000000000E0") in Java

Samual Sam

Samual Sam

Updated on 30-Jul-2019 22:30:24

51 Views

DecimalFormat is a concrete subclass of NumberFormat that formats decimal numbers. Let us set DecimalFormat("0000000000E0") first.Format f = new DecimalFormat("0000000000E0");Now, we will format a number and display the result in a string using the format() method −String res = f.format(-97579.9146);Since, we have used both Format and DecimalFormat class in Java, ... Read More

Format Seconds in s format in Java

Samual Sam

Samual Sam

Updated on 30-Jul-2019 22:30:24

111 Views

The “s” format for seconds is like representing 1, 2, 3, 4 seconds, etc. We will use it like this.SimpleDateFormat("s");Let us see an example −// displaying seconds in s format simpleformat = new SimpleDateFormat("s"); String strSeconds = simpleformat.format(new Date()); System.out.println("Seconds in s format = "+strSeconds);Above, we have used the SimpleDateFormat ... Read More

Find a list of invalid email address from a table in MySQL?

Samual Sam

Samual Sam

Updated on 30-Jul-2019 22:30:24

1K+ Views

To find invalid email address, use the below syntax −SELECT yourColumnName FROM yourTableName WHERE yourColumnName NOT LIKE '%_@_%._%';The above syntax will give the list of all invalid email addresses. To understand the above syntax, let us create a table. The query to create a table is as follows −mysql> create ... Read More

Geographical plotting using Python plotly

Samual Sam

Samual Sam

Updated on 30-Jul-2019 22:30:24

288 Views

Python provides various libraries to handle geographical and graph data. Python plotly is one of those libraries which are used to draw geographical graphs. Plotly is a free and open source library. Plotly helps to plot various kinds of graphs like Line charts, Horizontal bar charts, bar charts, dashboards, scatter ... Read More

Extract the Day / Month / Year from a Timestamp in PHP MySQL?

Samual Sam

Samual Sam

Updated on 30-Jul-2019 22:30:24

745 Views

To extract the Day/Month/Year from a timestamp, you need to use the date_parse() function. The syntax as follows −print_r(date_parse(“anyTimeStampValue”));The PHP code is as follows −$yourTimeStampValue="2019-02-04 12:56:50"; print_r(date_parse($yourTimeStampValue));The snapshot of PHP code is as follows −The following is the output −Array ( [year] => 2019 [month] => 2 [day] => 4 ... Read More

Display TimeZone in z format in Java

Samual Sam

Samual Sam

Updated on 30-Jul-2019 22:30:24

182 Views

The z format means General Time Zone. We will use it like this.SimpleDateFormat("z");Let us see an example −// displaying timezone in z format SimpleDateFormat simpleformat = new SimpleDateFormat("z"); String strTimeZone = simpleformat.format(new Date()); System.out.println("TimeZone in z format = "+strTimeZone);Above, we have used the SimpleDateFormat class, therefore the following package is ... Read More

Format Year in yy format in Java

Samual Sam

Samual Sam

Updated on 30-Jul-2019 22:30:24

994 Views

To format year in yy format is like displaying year as 01, 02, 03, 04, etc. For example, 18 for 2018.Use the yy format like this.SimpleDateFormat("yy");Let us see an example −// year in yy format SimpleDateFormat simpleformat = new SimpleDateFormat("yy"); String strYear = simpleformat.format(new Date()); System.out.println("Current Year = "+strYear);Above, we ... Read More

How to DROP a database in MySQL with character '?' in its name?

Samual Sam

Samual Sam

Updated on 30-Jul-2019 22:30:24

183 Views

To drop a database with the character ‘?’ in its name, you need to use backtick symbol around the database name. The syntax is as follows −DROP DATABASE `yourDatabaseName`;To understand the above syntax, let us create a database. The query to create a database is as follows −mysql> create database ... Read More

Advertisements