(866) 837-0540
 
 

Internet Marketing and Design Services for Turnkey Web Solutions 

Facebook Twitter Gplus Flickr LinkedIn YouTube Google Maps E-mail RSS
 
 
Home » web development » web design » ASP » Proper Date Time format for MySQL from classic ASP code
formats

Proper Date Time format for MySQL from classic ASP code

To properly put the date and time into a MySQL date field, you need to put it into the format of:

yyyy-mm-dd hh:mm:ss

Here is some code to do this in classic ASP for input into a MySQL table:

Dim testdate, testmonth, testday, ISODate
testdate = Request.Form("frmField5")
testmonth = Right(Month(testdate),2)
testday = Right(Day(testdate),2)
ISODate = Year(testdate) & "-" & testmonth & "-" & testday & " " & hour(testdate) & ":" & minute(testdate) & ":" & second(testdate)

The ISODate variable is in the correct format to insert in a MySQL UPDATE or INSERT SQL statement. Below is an example SQL string to UPDATE a date field in a MySQL table:

UPDATE myTable SET thisdate = 'ISODate' WHERE myID = 'thisID'

VN:F [1.9.13_1145]
Rating: 7.3/10 (6 votes cast)
VN:F [1.9.13_1145]
Rating: +1 (from 1 vote)
Proper Date Time format for MySQL from classic ASP code, 7.3 out of 10 based on 6 ratings
 
Take a piece of the Web from WebPaws.com: These icons link to social bookmarking sites where readers can share and discover new web pages.
  • Facebook
  • LinkedIn
  • TwitThis
  • MySpace
  • Google Bookmarks
  • Webnews
  • Digg
  • del.icio.us
  • StumbleUpon
  • eKudos
  • email
  • Fleck
  • Hype
  • MisterWong
  • Print
  • Technorati
  • YahooMyWeb
 
Tags: , , ,

One Response

  1. piano rentals…

    Hello ;) Thanks heaps for this indeed!… if anyone else has anything, it would be much appreciated. Great website Super Piano Links http://www.en.Grand-Pianos.org Enjoy!…

    VA:F [1.9.13_1145]
    Rating: 0.0/5 (0 votes cast)
    VA:F [1.9.13_1145]
    Rating: 0 (from 0 votes)

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

© Copyright © 1998-2011, WebPaws.com All rights reserved.
credit