Convert .NET JSON Date using .jsondate()

.jsondate() - Format .NET JSON Dates


Description: Convert JSON dates (returned from .NET server side) to a date that can be understood.


Example:

<!doctype html>
    <html lang="en">
    <head>
      <meta charset="utf-8">
      <title>jsondate demo</title>
      <script src="http://code.bitsycode.com/bitsycode-latest.min.js"></script>
    </head>
    <body>
        
        <div class="result"></div>
        
        <script>
            
            (function(){
                
                var newDate = bitsyCode.jsondate("/Date(1437256800000)/", { format:'-' });
                bitsyCode(".result").html(newDate);                
                
            })();
            
        </script>
     
    </body>
    </html>

Preview:

7-19-2015
  • Usage

    • How to use:

      Parse through a JSON date (returned from .NET server side) to get converted to JavaScript date.

      bitsyCode.jsondate('/Date(1437256800000)/', { format:'-' });
  • Options

    • What options are there:
      format: "/" (default value) // Specify a separator for the returned value eg. -
  • Returns

    • Returns:

      Formatted JavaScript date.

Share