Ändra datumformat i ASP
Ändra datumformat i ASP
När jag skriver =now i ASP så skrivs datumet i formatet: 01-10-2003 13:46:44
Hur gör jag för att det ska ändras och skrivas i svenskt format: 2003-10-01 13:46:44
Hur gör jag för att det ska ändras och skrivas i svenskt format: 2003-10-01 13:46:44
Re: Ändra datumformat i ASP
Är också svenskt, bara man har månaden i mitten så.Pich wrote:01-10-2003 13:46:44
. .. ... .... ..... ...... ....... ....... ..........
Code: Select all
Format(Now, "yyyy-m-dd hh:mm:ss")
Du kan också prova:
Code: Select all
Format(Now, "ddddd ttttt")
Ta en titt här.
The three most dangerous things in the world are a programmer with a soldering iron, a hardware type with a program patch and a user with an idea.
In theory, there is no difference between theory and practice. But, in practice, there is.
In theory, there is no difference between theory and practice. But, in practice, there is.
Jag som inte kan det här med ASP:
Hur är det med att skriva stort M?
Hur är det med att skriva stort M?
1. Nigger guy, two words which by themselves are harmless, but when combined they form a verbal missile of hate.
2. Vivaldi
3. Buffalos ...
2. Vivaldi
3. Buffalos ...
Har ingen aning om det går.. bara att prova sig fram, det är det enklaste sättet att få svar när det gäller ASP. MS:s dokumentation är ju... mindre bra.lither wrote:Jag som inte kan det här med ASP:
Hur är det med att skriva stort M?
The three most dangerous things in the world are a programmer with a soldering iron, a hardware type with a program patch and a user with an idea.
In theory, there is no difference between theory and practice. But, in practice, there is.
In theory, there is no difference between theory and practice. But, in practice, there is.
nva wrote:Tyvärr ger det inte månaden i två siffror, men jag vet inte hur man löser det (mm ger ju minuterna).Code: Select all
Format(Now, "yyyy-m-dd hh:mm:ss")
Du kan också prova:Som bör ge datumet i det formatet du vill ha om du har satt regional settings till sverige i windows.Code: Select all
Format(Now, "ddddd ttttt")
Ta en titt här.
Jag är inte riktigt säker på om jag vet hur jag ska göra. Hur gör jag för att skriva ut det formaterade datumet? Ska jag lagra det i en variabel och sedan skriva ut, eller? Så här: <% Variabel = Format(Now, "ddddd ttttt") %>
MVH Per
Skriv
så skrivs det ut.
Code: Select all
Response.Write(Format(Now, "yyyy-m-dd hh:mm:ss"))
The three most dangerous things in the world are a programmer with a soldering iron, a hardware type with a program patch and a user with an idea.
In theory, there is no difference between theory and practice. But, in practice, there is.
In theory, there is no difference between theory and practice. But, in practice, there is.
nva wrote:Skrivså skrivs det ut.Code: Select all
Response.Write(Format(Now, "yyyy-m-dd hh:mm:ss"))
Hmm... Jag får detta felmeddelande:
Microsoft VBScript runtime error '800a000d'
Type mismatch: 'Format'
/pages/protest.asp, line 82
Ups.. Format() fungerar nog bara i VB då, inte VBScript. Här är ett förslag på hur du kan göra istället:
Här är en referens.
Code: Select all
Response.Write(Year & "-" & Month & "-" & Day & " " & Hour & ":" & Minute & ":" & Second)
The three most dangerous things in the world are a programmer with a soldering iron, a hardware type with a program patch and a user with an idea.
In theory, there is no difference between theory and practice. But, in practice, there is.
In theory, there is no difference between theory and practice. But, in practice, there is.
Ok, tack så mycket för hjälpen men jag hittade ett ganska bra sätt att lösa det på. Jag utnyttjade Internets goda möjligheter att hitta färdig, gratis kod. Tog därmed hjälp av den här sidan:
http://www.aspfree.com/articles/1289,1/articles.aspx
http://www.aspfree.com/articles/1289,1/articles.aspx