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 7847667
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T17:58:37+00:00 2026-06-02T17:58:37+00:00

I wonder to know how to set today’s date in json file like we

  • 0

I wonder to know how to set today’s date in json file like we are using in js.

Is there any option to specify Date.today() in json file?

Because, json data has date object which specifies system date whenever we read the json file.

Hope, you will understand what i am trying to say.

Thanks in advance,

-Raja.

  • 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-02T17:58:38+00:00Added an answer on June 2, 2026 at 5:58 pm

    JSON is a structured transport format. It does not have logic in it.

    But here are options:

    1. Why not just get the date when you read the file instead?

    2. Have a server generate that JSON that includes the date at which it was generated. However, this is not ideal if you want the current date. By the time you read the file, the date generated by the server is already past.

    3. build a parser that parses a string and make it search for custom markup.

    For example, special markup is contained in @{}. Get the command inside, determine the command, and execute replacement.

    var jsonString = '{"data1" : "foo","date" : "@{currentdate}"}'
    

    In this case, I’ll find @{currentdate}. I should create a function corresponding to this command to replace @{currentdate} into the current date during read (in the format you want)

    var parsedString = jsonString.replace(/@\{(\w+)\}/g, function(match, group) {    
        if (group === 'currentdate') {
            return new Date();
        } 
        else if (group === 'anotherCommand') {
            return 'anotherValue';
        } //and so on
    });
    

    and the result is like this:

    jsonString = '{"data1" : "foo","date" : "Fri May 04 2012 01:17:07 GMT-0700 (PDT)"}'
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'd like to know if there is any native way to extract a set
I am using firefox addon builder (Addon kit 1.7) and I wonder to know
I wonder is there any Skype API for Android. What I wanted to do
I wonder if there is any way to do this: <asp:Label ID=lblSomething runat=server Visible=this.ShowLabel/>
I know there's something wrong with my code because the page never loads so
I wonder if there is any way to serialize to xml a class that
I've been using binding frameworks for a while now and i'd like to know
I know I can set a variable like that $xml->path->to->tag = $newValue . But
As I know Samsung Bada is not operating system but, just wonder if I
I know & is used to create references. But I wonder what having 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.