
![]() |
nutballs
classic
ASPfunction(s) to convert windows now() timestamp to a MySQL Timestamp. Its only a 1way function, but its generally only needed in that 1 direction anyway. There would be little reason to ever change from Mysql toASPtimestamps, but actually i havent tried whether formatdate() would do the trick anyway.Just pass Now() or some other ASPformatted date/time timestamp.'============== MySQL TimeStamp Functions next 3 function mysqltimestamp( aspts)dim thetime,thedate aspts=cstr(aspts)thedate=left( aspts,instr(aspts," "![]() thetime=right( aspts,len(aspts)-instr(aspts," "![]() mysqltimestamp=mysqldate(thedate)&" "&mysqltime(thetime) end function function mysqlDate(d) dim strNewDate strNewDate = year( d ) & "-" & month( d ) & "-" & day(d) mysqlDate = strNewDate end function function mysqlTime(t) dim strSuffix, arTime, i, x t = trim( Lcase( t ) ) if inStr( t, "pm" ) > 0 OR inStr( t, "am" ) > 0 then strSuffix = right( t, 2 ) t = left( t, inStr( t, strSuffix ) -2 ) t = trim( t ) end if for i = 1 to len( t ) x = mid( t, i, 1 ) if not isNumeric( x ) and x <> ":" then t = replace( t, x, "" ) next arTime = split( t, ":" ) t = "" for i = 0 to 2 if uBound( arTime ) < i then redim preserve arTime( i ) if i = 0 then if strSuffix = "pm" and cInt( arTime( i ) ) < 12 then arTime( i ) = cInt( arTime( i ) ) + 12 end if end if do until len( arTime( i ) ) = 2 arTime( i ) = "0" & arTime( i ) loop t = t & arTime( i ) if i < 2 then t = t & ":" next arTime = null if dir = 2 then t = t & " " & strSuffix 'debug( t ) mysqlTime = t end function '============== END MySQL TimeStamp Functions |

Thread Categories

![]() |
![]() |
Best of The Cache Home |
![]() |
![]() |
Search The Cache |
- Ajax
- Apache & mod_rewrite
- BlackHat SEO & Web Stuff
- C/++/#, Pascal etc.
- Database Stuff
- General & Non-Technical Discussion
- General programming, learning to code
- Javascript Discussions & Code
- Linux Related
- Mac, iPhone & OS-X Stuff
- Miscellaneous
- MS Windows Related
- PERL & Python Related
- PHP: Questions & Discussion
- PHP: Techniques, Classes & Examples
- Regular Expressions
- Uncategorized Threads