Click to See Complete Forum and Search --> : date...


weee
06-01-2004, 09:30 PM
I have a date in a field in this format: dd/mm/yyyy
I want to take it out of the field and putting it into a database but first I have to make it: mm/dd/yyy before it goes in.

How can I do it?

Thanks!

buntine
06-01-2004, 10:09 PM
The formatDateTime() VBScript function may work depending on your PC's regional settings.

Dim dteFormat
dteFormat = FormatDateTime(originalDate, 2)

You could also use some string handling functions to construct the formatted date.

Regards,
Andrew Buntine.

weee
06-02-2004, 01:53 PM
Microsoft VBScript runtime error '800a000d'
Type mismatch: 'FormatDateTime'

This is my code:
serviceStartDate = FormatDateTime(request.form("serviceStartDate"), 2)

Why's that?

NCit
06-03-2004, 03:15 PM
I advise you string handling;


<%
strFormatDate = Right(("0" & Month(CDate(strOriginalDate))), 2) & "/" &_
Right(("0" & Day(CDate(strOriginalDate))), 2) & "/" &_
Year(CDate(strOriginalDate))
%>


Also if you convert your form value into date maybe your code will also work


<%
serviceStartDate = FormatDateTime(CDate(request.form("serviceStartDate")), 2)
%>

weee
06-03-2004, 03:16 PM
!