Jump to content

Leading Zeros Being Stripped Off Date

Recommended Posts

I have a table that keeps track of the work schedule for our clients.  The record contains the date that the assignment was opened, the ID assigned to the assignment, the name of the company, and product purchased.  I have a report that sorts all open assignments by a concatenated field of all the above fields.  The result of the HTML code looks like:


     02/19/2016 - 32984 - Company Name (Product)


This portion works perfectly.


I have another DataPage that allows for the work schedule record to be modified.  Some times the assignment is put on hold, some times the start date needs to be modified, etc.  As soon as I open the DataPage that modifies the information, the Date changes from "02/19/2016" to "2/19/2016".  The usual change is for an assignment to be put on hold and if I update the status, the new result of the display field is:


     Hold - 2/19/2016 - 32984 - Company Name (Product)
If I change the Date from the calendar popup as well as the status, I get the following result:
     Hold - 02/20/2016 - 32984 - Company Name (Product)
The problem is when sorting the report showing all assignments, the sort order is incorrect because there is no proceeding "0" in some of the dates.  Here is the code pasted in the footer to create the value.  
function concatenate1()
var SchedStatus = document.getElementById("EditRecordStatus").value;
var Control = document.getElementById("EditRecordID").value;
var Company = document.getElementById("EditRecordCompany").value;
var Company25 = Company.substring(0,25);
var Date = document.getElementById("EditRecordDate_Open").value;
var Product = document.getElementById("EditRecordProduct").value;
var Product7 = Product.substring(0,7);
if (SchedStatus == "Hold")
var DateControl = 'Hold - ' + Date + ' - ' + Control + ' - ' + Company25 + ' (' + Product7 + ')';
} else {
var DateControl = Date + ' - ' + Control + ' - ' + Company25 + ' (' + Product7 + ')';
document.getElementById("EditRecordDate_Control").value = DateControl;
What I need to know is how to get the proceeding "0" to remain in the date.
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...