|
-
Jul 11th, 2001, 02:15 PM
#1
Thread Starter
Lively Member
Foolproof function for dates in dd/mm/yy format?
Anyone know how to fix the date problem. It keeps swapping to mm/dd/yy. I need dd/mm/yy
Thanks
You are living a pacifist dream, and if you dreaming it means you sleeping and you should damn well wake up!
-
Jul 11th, 2001, 02:41 PM
#2
Thread Starter
Lively Member
This is what I have done which sometimes worjks
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.
You are living a pacifist dream, and if you dreaming it means you sleeping and you should damn well wake up!
-
Jul 12th, 2001, 01:21 AM
#3
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
-
Jul 12th, 2001, 02:31 AM
#4
So it could be just me, but I thought VBScript doesn't support the format function, but only the formatdatetime function?
-
Jul 12th, 2001, 06:47 AM
#5
yes format is in VB6 . dont know about vbscript.
-
Jul 12th, 2001, 10:50 AM
#6
Addicted Member
Create function to convert your date :
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
Hope it helps !
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|