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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T04:45:24+00:00 2026-06-11T04:45:24+00:00

I am generating a reference number, using jQuery and Php comprising: a static string,

  • 0

I am generating a reference number, using jQuery and Php comprising:
a static string, a dynamic letter of the alphabet, the date in Month and Year and an autogenerated id.

I have these four elements concatenated as below.

$("#refno").text("ABC" + str + <?php echo date('Y') ?>  + <?php echo date('m')?>  + <?php echo $id -> id + 1; ?>);

str is the dynamic letter , set by selecting from a dropdown.
It is required that I output the month in the mm format e.g 09 for September.

Challenge is, the leading zero in the month is truncated in the resulting ref number. e.g
instead of ABCR20120923 i get ABCR2012923 . Yet when I echo date('m') 09 is output.

While I could choose to have an if statement that concatenates a zero onto the single
character months, I would want to understand why zero is truncated and how I can have it
displayed.

Thanks.Help Appreciated.

  • 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-11T04:45:25+00:00Added an answer on June 11, 2026 at 4:45 am

    09 on its own in treated like an integer – a number does not make sense with leading zeros.

    $("#refno").text("ABC" + str + <?php echo date('Y') ?>  + "<?php echo date('m')?>"  + <?php echo $id -> id + 1; ?>);
    

    Add quotes

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

Sidebar

Related Questions

I am generating a C# service reference using Visual Studio 2010 from my wsdl.
I'm generating json from a Rails app, and am filtering fields using the format.json
I'm currently generating the amount of time given the number of seconds. This is
I'm generating dynamic HTML inside Delphi. I have no problem displaying UTF-8 strings inside
I'm generating Java classes from a WSDL using the jaxws-maven-plugin's wsimport goal. Out of
I am adding a WCF Service Reference in a Silverlight project, it is generating
I am new to lotus. I have a task. there is a reference number
I am dynamically generating XAML which has a reference to a resource custom font.
Im using Stimulsoft for generating report. I want to create an index page like
After generating the artifacts for a Java WS client, why is the wsdllocation reference

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.