Quality Testing

Quality is delighting customers

How to convert date format from mm/dd/yyyy to dd:mm:yyyy?

How to convert date format from mm/dd/yyyy to dd:mm:yyyy using VB Script?

Please help me out. this was the question asked in one interview.


Views: 1746

Reply to This

Replies to This Discussion

I'm sorry, but in my opinion you should find it out yourself. VB Script is supported at all MS Office products, so do the code there. At testing the problem solving is one of the most important skills. And asking help from forum at very simple question is not correct problem solving. It's rather cheating.

I don't mean to be nasty for you. I hope this is rather helping and encouraging you to find out things yourself. And also I hope this encourages you to try things you've never tried before.
msgbox v2
try this

s = Day(Date) & "/" & Month(Date) & "/" & Year(Date)

us string replace function find / replace with

hope this will help

All above answers tell you to convert system date to dd:mm:yyyy or d:mm:yyyy or dd:m:yyyy or d:m:yyyy, but not given date.There is different approach to convert system date to dd:mm:yyyy.

iDate = "25/11/2010"
DateArray = Split(iDate, "/")
fDate = DateArray(0) & ":" & DateArray(1) & ":" & DateArray(2)
Hi Nivas,

Try this, may be helpful.................

Dim vDate
Dim vMonth
Dim vYear
Dim vSystemDate
Dim vConverted_Date

vSystemDate = Date

vDate = Datepart("d",vSystemDate)
vMonth = Datepart("m",vSystemDate)
vYear = Datepart("yyyy",vSystemDate)

If len(vDate) = 1 then
vDate = "0" & vDate
vDate = vDate
End If

If len(vMonth) = 1 then
vMonth = "0" & vMonth
vMonth = vMonth
End If

vConverted_Date = vDate & ":"&vMonth & ":" & vYear
msgbox vConverted_Date

Best Regards,
Bibin Babu
set Dateformat DMY


TTWT Magazine





© 2021   Created by Quality Testing.   Powered by

Badges  |  Report an Issue  |  Terms of Service