JavaScript How to remove comma between date and time on toLocaleString() in Js remove comma between quotes,remove comma between names excel,remove

var date ="03/05/2013";
var localDate = date.split("/").reverse().join("-");
var localTime = "20:41"
var UTCDateTime = localDate+ "T" + localTime +":00.000Z";
localDateTime = new Date(UTCDateTime)

var options = { hour12: false, day: '2-digit', month: '2-digit', year: 'numeric', hour: '2-digit', minute:'2-digit' };
console.log("Date:>>"+localDateTime.toLocaleString('en', options));
Answer:1

I wouldn't replace the comma with either the replace function or a regex, because that could easily result in the wrong commas being removed. The short date format that you use in your example doesn't contain a comma in the date part, but a longer date format like { day: '2-digit', month: 'long', year: 'numeric', hour: '2-digit', minute:'2-digit' } will.

A more resilient option is to format the date and time parts separately, and concatenate them with a space in between:

var date ="03/05/2013";
var localDate = date.split("/").reverse().join("-");
var localTime = "20:41"
var UTCDateTime = localDate+ "T" + localTime +":00.000Z";
localDateTime = new Date(UTCDateTime)

var dateOptions = { day: '2-digit', month: '2-digit', year: 'numeric' };
var timeOptions = { hour12: false, hour: '2-digit', minute:'2-digit' };
console.log("Date:>>" + localDateTime.toLocaleDateString('en', dateOptions) + " " + localDateTime.toLocaleTimeString('en', timeOptions));
Answer:2

With replace:

var date ="03/05/2013";
var localDate = date.split("/").reverse().join("-");
var localTime = "20:41"
var UTCDateTime = localDate+ "T" + localTime +":00.000Z";
localDateTime = new Date(UTCDateTime)

var options = { hour12: false, day: '2-digit', month: '2-digit', year: 'numeric', hour: '2-digit', minute:'2-digit' };
console.log("Date:>>"+localDateTime.toLocaleString('en', options).replace(',',''));
Answer:3

I have done a lot of research and am not sure what the best approach is. I have a Kendo Grid (table) with 3 rows and 3 columns. I show a table with only the first column populated upon initial page ...

I have done a lot of research and am not sure what the best approach is. I have a Kendo Grid (table) with 3 rows and 3 columns. I show a table with only the first column populated upon initial page ...

  1. draw square using css
  2. draw square using dda algorithm
  3. draw square using logo commands
  4. draw square using compass
  5. draw square using repeat command
  6. draw square using opengl
  7. draw square using turtle
  8. draw square using html
  9. draw square using dda
  10. draw square using scratch
  11. draw square using three lines
  12. draw using square
  13. c++ draw square using loop
  14. draw a square using python
  15. draw a square using only 3 lines
  16. draw a square using java
  17. draw a square using turtle python
  18. draw objects using square
  19. how to draw square using autocad
  20. draw an angle square using sine and cosine

I am attempting to run a paired t-test in bigquery using the JavaScript statistical.js library and I am getting inconsistent numbers. My code is as follows; CREATE TEMPORARY FUNCTION ttest(a ARRAY&...

I am attempting to run a paired t-test in bigquery using the JavaScript statistical.js library and I am getting inconsistent numbers. My code is as follows; CREATE TEMPORARY FUNCTION ttest(a ARRAY&...

When adding elements via pure js on Vue Single File Component, the added elements don't have v-id-xx attribute for scoped css. How can I get THE component's v-id-hash value by pure js?

When adding elements via pure js on Vue Single File Component, the added elements don't have v-id-xx attribute for scoped css. How can I get THE component's v-id-hash value by pure js?

How to access a nested property, in a safe way (i.e. without throwing a TypeError) (a.b) ? a.b.c : undefined Is there a less verbose way, without using a framework ?

How to access a nested property, in a safe way (i.e. without throwing a TypeError) (a.b) ? a.b.c : undefined Is there a less verbose way, without using a framework ?

  1. access nested property javascript
  2. javascript access nested property by string
  3. access nested object property javascript
  4. js access nested property by string
  5. lodash access nested property
  6. es6 access nested property
  7. javascript access nested property dynamically
  8. typescript access nested property
  9. access nested json property javascript
  10. access nested json property
  11. js access nested property
  12. access nested object property js
  13. javascript safely access nested property
  14. javascript access nested object property with variable
  15. js access nested object property by string
  16. javascript access object nested property by string
  17. typescript access nested object property
  18. javascript access nested object property dynamically
  19. c# access nested class property
  20. php access nested object property