Author: djones

  • How to format date as string in the format “yyyy-MM-dd” in Javascript

    How to format date as string in the format “yyyy-MM-dd” in Javascript

    Here are two ways to format a date to the “yyyy-MM-dd” string in JavaScript: 1. Using toLocaleDateString: This method is the simplest and most versatile way to format dates in JavaScript. It allows you to specify the desired format and optionally the locale and other options. 2. Using string manipulation: This method offers more flexibility… Read more

  • How to return multiple values from a method in C#

    How to return multiple values from a method in C#
    , ,

    There are typically 2 ways that we return values from a method, create a custom type or use multiple out parameters. Well, there is another way that this can be achieved and it’s by using a feature introduced in C# 7 called a tuple. A tuple is a value-type that lets you group data into… Read more

  • Convert JSON array string to table of integer values using SQL!

    ,

    In SQL Server, the OPENJSON function is typically used to parse JSON objects or arrays. If you have a JSON array containing a list of integer values, you can use OPENJSON to extract those values. Here’s an example: Let’s assume you have a JSON array like this: You can use OPENJSON as follows: In this… Read more