Anyone know how to fix the date problem. It keeps swapping to mm/dd/yy. I need dd/mm/yy
Thanks
Printable View
Anyone know how to fix the date problem. It keeps swapping to mm/dd/yy. I need dd/mm/yy
Thanks
xDate = Day(myDate) & "/" & Month(myDate) & "/" & Year(myDate)
xdate= formatdatetime(xdate,1)
Then the date is stored as 10 July 2001 and not 10/07/01 which means the month and day cant be mixed up.
But when I put my project on a server running NT (I use PWS and win 98 at home) it game me an error in the SQL query. It didnt like having the date in that formate with the hashes ...i.e.
#10 July 2001#
so any ideas on how to fix my way or a totally new foolproof way. There must be some way of sorting it all out.
the day/month format depends on the Windows setting, hence different on different machines!
I use only :
mydatestring = format(now("dd/mm/yyyy")
or one of the many " " options. (check out help: format, user defined options)
this always gives you a string as you expect it
So it could be just me, but I thought VBScript doesn't support the format function, but only the formatdatetime function?
yes format is in VB6 . dont know about vbscript.
Create function to convert your date :
Hope it helps !Code:Dim strDay, strMonth, strYear
Dim strDate
strDay = Day(Now)
If len(strDay) < 2 Then strDay = "0" & strDay
strMonth= Month(Now)
If len(strMonth) < 2 Then strMonth= "0" & strDay
strYear = Year(now)
strDate = strDay & "/" & strMonth & "/" & stryear