Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8685763
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T22:39:22+00:00 2026-06-12T22:39:22+00:00

Issues is parsing date using Moment js library I’m using Moment js library to

  • 0

Issues is parsing date using Moment js library

I’m using Moment js library to format date from Json. Date format in json is 2012-09-28 16:18:02 -0400.
I want to convert it into this format on client side in this format : 19th Aug 2012 at 10:50 pm.
This is what i tried out…

var a= moment("2012-09-28 16:18:02 -0400");
var day=a.format("Do MMMM YYYY, h:mm:ss a");
console.log(day);   //Outputs  28th September 2012, 9:30:00 am

But everytime it shows 9:30:00 am.

How can i resolve this ?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T22:39:23+00:00Added an answer on June 12, 2026 at 10:39 pm

    Try adding date format as second parameter to moment(...):

    var a= moment("2012-09-28 16:18:02 -0400", "YYYY-MM-DD hh:mm:ss Z");
    var day=a.format("MMMM Do YYYY, h:mm:ss a");
    console.log(day); ​
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am facing an issue with parsing/converting a dateString from browser to Date format
I convert two types of Strings to an ISO format using SimpleDateFormat for parsing
I'm using the MPXJ library in .NET for parsing MS Project (MPP) files, and
I am making a request for data and parsing it in JSON format however
Im having a little issue with parsing json date. Here is what I would
I am facing an issue in parsing a JSON data which is retrieved from
I am trying to test a few ajax and JSON parsing examples using YUI3
I am parsing an XML file using simpleXML to get the dates from the
I am parsing an HTML file and having a few issues. I am using
I am stuck using an AJAX library from about 5 years ago in this

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.