Virajsinh

Best Date Time Library For JavaScript

Nov 23rd, 2021 (edited)
1,181
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
jQuery 0.58 KB | None | 0 0
  1. //Best DateTime Library For JavaScript URL => https://momentjs.com/
  2.  
  3. var date = new Date(c_row.dateadded);
  4. var d = date.getDate(); // Date
  5. var m = date.getMonth() + 1; // Month
  6. var y = date.getFullYear(); // Year
  7. var monthName = date.toLocaleString('default', {
  8.     month: 'short'
  9. });
  10. var commet_time = date.toLocaleString('default', {
  11.     // month: 'short',
  12.     hour: 'numeric',
  13.     minute: 'numeric',
  14.     hour12: true
  15. });
  16. var comment_date = d + '/' + m + '/' + y;
  17.  
  18. // dd/mm/yyyy To mm/dd/yyyy
  19. var date1 = "28/01/2019".split('/')
  20. var newDate = date1[1] + '/' +date1[0] +'/' +date1[2];
Add Comment
Please, Sign In to add comment