get year from date (yyyy-mm-dd)

Inputs

  • Date (yyyy-mm-dd)

Outputs

  • Year

Neuron type

Best algorithm has been found - locked

Patterns

Pattern Input Output
1.
Date (yyyy-mm-dd): Yyyy-mm-dd
Year: Yyyy
2.
Date (yyyy-mm-dd): 2000-11-23
Year: 2000
3.
Date (yyyy-mm-dd): 1900-6-7
Year: 1900

Applicable neurons

  • character -
  • Substring (startPosition, endPosition)
  • Substring (from start to position)
  • Substring (from position to end)
  • Get substring between string1 and string2
  • Get before substring
  • Get after last substring
  • Get first letter
  • Get first word
  • Get last character
  • Get the last XY characters
  • before decimal point
  • Cut String At specific character
  • Swap first and second words
  • Contains string substring?
  • Sum of complex numbers
  • Rectangle - content
  • Cube - surface area
  • Percentage (X% / 100)
  • Get html between tags (text)

Algorithm

Test

Code made by AI:
/**
 * character -: 
 *
 * @return {Array}
 */
function neuron511()
{
return['-'];
}

/**
 * Position: Search position substring of string
 *
 * @param x1 MyString
 * @param x2 FindMe
 * @return {Array}
 */
function neuron523(x1, x2)
{
return [x1.toString().indexOf(x2.toString())];
}

/**
 * 0: 
 *
 * @return {Array}
 */
function neuron500()
{
return [0];
}

/**
 * Substring (startPosition, endPosition): Get substring from string - from position - to pos
 *
 * @param x1 MyString
 * @param x2 start position
 * @param x3 end position
 * @return {Array}
 */
function neuron525(x1, x2, x3)
{
return[x1.toString().substring(x2, x3)];
}

/**
 * Get before substring: 
 * 
 * @param x1 MyString
 * @param x2 Substring
 * @return {Array}
 */
function neuron532(x1, x2)
{
  var outputs = [];
  outputs[0] = x1;
  outputs[1] = x2;

  arr = neuron523(outputs[0], outputs[1]);
  outputs[2] = arr[0];

  arr = neuron500();
  outputs[3] = arr[0];

  arr = neuron525(outputs[0], outputs[2], outputs[3]);
  outputs[4] = arr[0];

  return[outputs[4]];
}


/**
 * IF: IF a THEN b ELSE c;
 *
 * @param x1 condition (1/0)
 * @param x2 variable for 1
 * @param x3 variable for 0
 * @return {Array}
 */
function neuron579(x1, x2, x3)
{
return [(x1) ? x2 : x3];
}

/**
 * Cut String At specific character: 
 * 
 * @param x1 string
 * @param x2 specific character
 * @return {Array}
 */
function neuron822(x1, x2)
{
  var outputs = [];
  outputs[0] = x1;
  outputs[1] = x2;

  arr = neuron532(outputs[0], outputs[1]);
  outputs[2] = arr[0];

  arr = neuron579(outputs[2], outputs[2], outputs[0]);
  outputs[3] = arr[0];

  return[outputs[3]];
}


/**
 * get year from date (yyyy-mm-dd): 
 * 
 * @param x1 Date (yyyy-mm-dd)
 * @return {Array}
 */
function neuron887(x1)
{
  var outputs = [];
  outputs[0] = x1;

  arr = neuron511();
  outputs[1] = arr[0];

  arr = neuron822(outputs[0], outputs[1]);
  outputs[2] = arr[0];

  return[outputs[2]];
}


Code made by AI:

Rodokmen - poznejte své předky | TOPlist U.I., Umělá inteligence