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

  • Home
  • SEARCH
  • 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 8869517
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T17:29:49+00:00 2026-06-14T17:29:49+00:00

I have a MongoDB schema like this var Person = new Schema({ Name: {

  • 0

I have a MongoDB schema like this

var Person = new Schema({
  "Name": { type: String, required: true },
  "DOB": {  type: Date, "default": Date.now  }
});

And a new object is created( NodeJs using mongoose ODM)

{   
  "Name": "Dany",  
  "_id": "50ae0cb32c46b2901c000001",  
  "__v": 0,  
  "DOB": "2012-11-22T12:54:43.852Z"   
}   

I can retrieve this object and DOB from it. What I want is: To convert this DOB into some suitable format which can be directly assign it in an HTML5 “date” input element.And this has to be rendered using jade and Handlebars.

Similar to something like var brthday = Person.DOB.tosome_suitable_form); and then <input type="date" value="brthday"> or
(instead of html syntax jade and Handlebars syntax is required). How do I do 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-14T17:29:50+00:00Added an answer on June 14, 2026 at 5:29 pm

    Try moment.js, it is an almost standard date module for nodejs. You can use moment(doc.DOB).format('whatever_format_you_want'). You can see the formats from their docs.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a schema like this (simplified) var Language = new Schema({ name: String
I have a MongoDb schema like this var User = new Schema({ UserName: {
i have mongoose schema named administrator var administratorSchema = new mongoose.Schema({ username : String,
I have nodejs application with mongodb(mongoose). like this: var mongoose = require('mongoose'); var express
I have some data in MongoDB that looks like this: { name: Steve, location:
In MongoDB I have a query which looks like this to find out for
I have dates stored in MongoDB using Date(), MongoDB uses UTC it's date type,
I have this query in MongoDB db.privateMessages.find( { $or : [ {fromId: userId, toId:
I am new to MongoDB, but am looking at it to solve this problem:
I have an object in my mongodb collection. Its schema is: { instruments: [A,

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.