Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Dates 2

Status
Not open for further replies.

NotSQL

Technical User
May 17, 2005
205
GB
Can anyone help me convert a date which is represented as month/day/year to day/month/year

eg

10/03/2007 should be 03/10/2007


Regards
Dave
 
A starting point:
dmy = Mid(mdy,4,3) & Left(mdy,3) & Right(mdy,4)

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Sorry PHV Im new to VBscript so think may need to explain this to me...

Thanks
 
mdy is the name of the variable holding the date represented as mm/dd/yyyy
dmy will contain the same date as dd/mm/yyyy

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Try this:

Code:
dim kdate
dim normaldate
dim datebits

kdate = "3/10/2007"
datebits = split(kdate,"/")
normaldate = cdate(datebits(1) & "/" & datebits(0) & "/" & datebits(2))
msgbox(normaldate)

This allows for single or double digit days and months.


Hope this helps.

[vampire][bat]
 
Sorry, I forgot to include the formatting:

Code:
dim kdate
dim normaldate
dim datebits

kdate = "3/10/2007"
datebits = split(kdate,"/")
normaldate = formatdatetime(cdate(datebits(1) & "/" & datebits(0) & "/" & datebits(2)), 0)
msgbox(normaldate)


Hope this helps.

[vampire][bat]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top