Welcome Guest ( Log In | Register )

Outline · [ Standard ] · Linear+

 ASP formatdatetime

views
     
nxfx
post Mar 2 2006, 08:55 AM

Enthusiast
*****
Senior Member
979 posts

Joined: Jan 2003


One way is to seperate the datetime and rebuild it as string.
If the date is like 03/02/2006 (MMDDYYYY) , break it to
DD = 02
MM = 03
YYYY = 2006

From here you can just manipulate the string.

mydate = DD & "-" & MM & "-" & YYYY
which looks like , 02-03-2006.

Just a suggestion anyway...
nxfx
post Mar 2 2006, 02:52 PM

Enthusiast
*****
Senior Member
979 posts

Joined: Jan 2003


How about my method?
I assume you want to save the datetime into your database, then how about formating it in the sql statement where the mysql has better formating option.
nxfx
post Mar 2 2006, 03:34 PM

Enthusiast
*****
Senior Member
979 posts

Joined: Jan 2003


Emm, something like

mydate = "17/03/2004"

sql = "insert into Tbl(mydate) "
sql = sql & " values(convert(datetime, ' " & mydate & "', 103))"

But this done using mssql, dunno if mysql have the same function.

 

Change to:
| Lo-Fi Version
0.0139sec    1.94    6 queries    GZIP Disabled
Time is now: 23rd December 2025 - 09:37 PM