Date Conversion with Zero Padding
Posted: Thu Dec 30, 2010 7:10 pm
How can I convert the dates in the formats below to" YYYY-MM-DD?
thanks,
Walt
# The date value on the file to be imported is in the following formats:
# m/d/yyyy
# mm/d/yyyy
# mm/dd/yyyy
# SUBST(string, beginning, length)
sMonth = SUBST(v_order_day,0,(SCAN( '/', v_order_day)-1));
sDayMonth = SUBST(v_order_day,(SCAN( '/', v_order_day)+1), Long(v_order_day));
sYear = SUBST(sDayMonth,(SCAN( '/', sDayMonth)+1), Long(sDayMonth));
sDay = SUBST(sDayMonth,0,(SCAN( '/', sDayMonth)-1));
# DATES(1998, 2, 10) returns '1998-02-10' # convert date to number.
sOrderDateString = DATES(sYear, sMonth, sDay); ----this does not work function expects numbers
l_OrderDateSerial = DayNo( sOrderDateString );
Thanks,
Walt
thanks,
Walt
# The date value on the file to be imported is in the following formats:
# m/d/yyyy
# mm/d/yyyy
# mm/dd/yyyy
# SUBST(string, beginning, length)
sMonth = SUBST(v_order_day,0,(SCAN( '/', v_order_day)-1));
sDayMonth = SUBST(v_order_day,(SCAN( '/', v_order_day)+1), Long(v_order_day));
sYear = SUBST(sDayMonth,(SCAN( '/', sDayMonth)+1), Long(sDayMonth));
sDay = SUBST(sDayMonth,0,(SCAN( '/', sDayMonth)-1));
# DATES(1998, 2, 10) returns '1998-02-10' # convert date to number.
sOrderDateString = DATES(sYear, sMonth, sDay); ----this does not work function expects numbers
l_OrderDateSerial = DayNo( sOrderDateString );
Thanks,
Walt