Link to home
Start Free TrialLog in
Avatar of Aleks
AleksFlag for United States of America

asked on

Help with function (ASP/VB Script)

I am using ASP / VB Classic.
The following function will return the date as:  01/01/2013, which is good, but I also need to enter the time along with the date. (Down to seconds)

Can you please provide the necessary code to change it so that it includes time after the date ?


<% function todayStr()
     dim theDate, theDay, theMonth
     theDate = FormatDateTime( now, 2)
     theMonth = Month(theDate)
     if CInt( theMonth ) < 10 then theMonth = "0" & theMonth

     theDay = Day( theDate )
     if CInt( theDay ) < 10 then theDay = "0" & theDay

     todayStr = theMonth & "/" & theDay & "/" & Year(theDate)
end function

Avatar of Scott Fell
Scott Fell
Flag of United States of America image

Link to home
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Aleks


Perfect !