PhilPPhillips
MIS
My database stores dates in YYYYMMDD format. I have a form that inputs dates in a date format i.e. 2/6/2006. I am trying to convert this into the YYYYMMDD format to save to the database. So far this is the code I have.
This sort of works except that when the date entered is 2/9/2006 the transfer_dt is written as 200629 instead of 20060209. How do I get the leading 0 in there for the day and month when appropriate?
Thanks ...
Code:
nYear = DatePart("yyyy", [receiptDate])
nMonth = DatePart("m", [receiptDate])
nDay = DatePart("d", [receiptDate])
cCombinedDate = CStr(nYear) & CStr(nMonth) & CStr(nDay)
[transfer_dt] = CLng(cCombinedDate)
This sort of works except that when the date entered is 2/9/2006 the transfer_dt is written as 200629 instead of 20060209. How do I get the leading 0 in there for the day and month when appropriate?
Thanks ...