Wednesday, March 21, 2012

problem formatting date

Hi all,
I make an insert of date with VB.Net using the "format" function:
format(Now(), "dd/MM/yyyy hh:mm:ss").
In my dev environment it work fine.
But when I put the page on production server
the format fuction change the tima formatting, change ":" with "."
so it pass hh.mm.ss to the DB crashing the insert.
I used a replace function to restore ":", and it work fine.
Bue any idea?
Why this happen
thanks allThis is a pure VB.NET question, so you probably have better luck asking this
in a VB.NET forum.
However, I strongly encourage you to format the datetime as 'YYYYMMDD hh:mm:
ss'. Check
http://www.karaszi.com/SQLServer/info_datetime.asp for the reason.
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"Henry Cabot Enaus III" <hceiii@.yahoo.com> wrote in message
news:512ff012.0409010324.126ebd78@.posting.google.com...
> Hi all,
> I make an insert of date with VB.Net using the "format" function:
> format(Now(), "dd/MM/yyyy hh:mm:ss").
> In my dev environment it work fine.
> But when I put the page on production server
> the format fuction change the tima formatting, change ":" with "."
> so it pass hh.mm.ss to the DB crashing the insert.
> I used a replace function to restore ":", and it work fine.
> Bue any idea?
> Why this happen
> thanks all

No comments:

Post a Comment