[ciapug] MS SQL timestamp to MySQL
David Champion
ciapug@cialug.org
Thu, 02 Oct 2003 16:01:31 -0500
Is your mm/dd/yyyy date in mysql a character field, or date? IMHO you
should always store dates in a date or datetime field. I usually use
datetime, that way if I need the time I can use it, otherwise I just
ignore the time and use the date.
I think this is what you need to use:
http://www.mysql.com/doc/en/Cast_Functions.html
-dc
Chris Hettinger wrote:
> I have a MS SQL datetime field with the format [yyyy-mm-dd hh:mm:ss.mmm] (milliseconds) that I need to compare to a date entered into my form as [mm/dd/yyyy]
>
> I was going to use my inputted date string ex. 06/30/1977 and convert that into a MySQL time stamp 1977-06-03 00:00:00. Well that is when I noticed the ms SQL format for the date was different.
>
> I asked a ms sql guy here and he recommended to me the CONVERT funtion that I can include in my SQL select statement to do the datetime conversion, to the format I want the date in, while building the records set that I will need to compare against. So I researched that but I haven't a good example of the syntax for the actual SQL statement.
>
> Would anyone have a suggestion or could lend an example of how to use the CONVERT to do this?
>
>
> -Chris Hettinger, Web Specialist
> -IFMC/ENCOMPASS
> -www.encompas.com
> -(515) 279-8730
>
>
>
> CONFIDENTIALITY NOTICE: This communication, including any attachment, may contain confidential information and is intended only for the individual or entity to whom it is addressed. Any review, dissemination, or copying of this communication by anyone other than the intended recipient is strictly prohibited. If you are not the intended recipient, please contact the sender by reply email, delete and destroy all copies of the original message.'
>
> _______________________________________________
> ciapug mailing list
> ciapug@cialug.org
> http://cialug.org/mailman/listinfo/ciapug
>