C RUBY-ON-RAILS MYSQL ASP.NET DEVELOPMENT RUBY .NET LINUX SQL-SERVER REGEX WINDOWS ALGORITHM ECLIPSE VISUAL-STUDIO STRING SVN PERFORMANCE APACHE-FLEX UNIT-TESTING SECURITY LINQ UNIX MATH EMAIL OOP LANGUAGE-AGNOSTIC VB6 MSBUILD

# Need to calculate the sum of second using a function from a string variable using SQL

By : Zoey
Date : October 18 2020, 06:10 PM
I wish did fix the issue. There is a column named as duration in a table called Adventurous.The column has values as below.In the column Suffix of 'H' is hours,Suffix of 'M' is minutes and Suffix of 'S' is seconds.How can we select the hours, minutes and seconds and convert all into seconds i.e sum of all the hours minutes and seconds in the form of seconds. , Try this:
code :
``````Declare @t table (duration varchar(50))

insert into @t values  ('PT1H2M18S')

select
convert(int,substring(duration,CHARINDEX('PT',duration)+2,(CHARINDEX('H',duration)-CHARINDEX('PT',duration))-2))*3600 +
convert(int,substring(duration,CHARINDEX('H',duration)+1,(CHARINDEX('M',duration)-CHARINDEX('H',duration))-1))*60 +
convert(int,substring(duration,CHARINDEX('M',duration)+1,(CHARINDEX('S',duration)-CHARINDEX('M',duration))-1))
from @t
``````

Share :

## How to calculate the derivate of a function for a set variable?

By : user83213
Date : March 29 2020, 07:55 AM
it should still fix some issue Let's say I input following sentences: , You need to use symbolic expression:
code :
``````syms x y            % creates symbolic variables x,y
y = x^2;            % symbolic expression
t = diff(y);        % t = 2*x (differentiate symbolic expression of y)
z = subs(t, x, 5)   % evaluate t, i.e. z=2*5=10
``````

## When we pass string variable as ref argument to function and change value of string variable in function

By : user2981034
Date : March 29 2020, 07:55 AM
I hope this helps . You are asking about 2 separate things:
1. Strings and String Data
code :
``````static void Main()
{
String str1 = "sample";
String str2 = str1;
ChangeString(ref str1);
}
void ChangeString(ref string str)
{
str = "New Sample";
}
``````
``````static void Main()
{
String str1 = "sample";
String str2 = str1;
str1 = "New Sample";
}
``````

## Calculate variable String(010) with integer(1) where outcome is string(011)

By : Unacorn
Date : March 29 2020, 07:55 AM
wish help you to fix your issue Considering you are handling Integer number (not binary )
Try something like this:
code :
``````String input ="001";//your user input
/**
* your check here if input is a  number
*/
int len=input.length();
int inputInteger=Integer.parseInt(input);
inputInteger+=1;

String output=String.format("%0"+len+"d", inputInteger);
System.out.println(output);
``````

## What's the way to just calculate a variable when it's called in a function?

By : Robert MacDonald
Date : March 29 2020, 07:55 AM
Hope that helps
i want to know if are there a way to check the elements used by fn(), and just calculate those.

## SPSS - calculate new variable from two string using if-then

By : Udenwa Chidi
Date : March 29 2020, 07:55 AM
This might help you I need to develop a statement that will pull string values from two col based on their values and missing values. For example. , This should do it:
code :
``````string new_var(a20).
if (COL_A<>"" and COL_B<>"") or COL_B="" new_var=COL_A.
if new_var="" and COL_B<>"" new_var=COL_B.
``````