Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to transform a date-string in classic asp

Tags:

asp-classic

I'm a little blockheaded right now…

I have a date string in european format dd.mm.yyyy and need to transform it to mm.dd.yyyy with classic ASP. Any quick ideas?

like image 858
Anheledir Avatar asked Dec 13 '22 06:12

Anheledir


2 Answers

If its always in that format you could use split

d = split(".","dd.mm.yyyy")
s = d(1) & "." & d(0) & "." & d(2)

this would allow for dates like 1.2.99 as well

like image 178
Re0sless Avatar answered Dec 15 '22 18:12

Re0sless


Dim arrParts() As String
Dim theDate As Date

arrParts = Split(strOldFormat, ".")
theDate = DateTime.DateSerial(parts(2), parts(1), parts(0))

strNewFormat = Format(theDate, "mm.dd.yyyy")
like image 38
Vincent McNabb Avatar answered Dec 15 '22 19:12

Vincent McNabb