date format  
Author Message
[XaToA]





PostPosted: 2003-7-30 16:54:00 Top

java-programmer, date format hello
i am begining to working againt one postgresql database with java.
i must to put into the database some dates.
i must to configure the date fields into the database. which will be the
date format? timestamp?
if in java i have the String d="03/03/2003" how can i to format, convert,
this String to date timestamp?

which will be the idoneous field format for storing the dates and for
working with java?

Thanks


 
Rob Feil





PostPosted: 2003-8-27 16:42:00 Top

java-programmer >> date format In article <bigugv$nab$email***@***.com>, panda@spam-and-harvard-
suck.yale.edu says...
> "Rob Feil" <email***@***.com> wrote in message
> news:email***@***.com...

> > Is there any way to convert the mysql-YYYYmmdd-format to ddmmYYYY?

> I would do the following:
> SELECT DATE_FORMAT(foo, '%m%d%Y') as bar
> (tack on the FROM and WHERE statements you're already using), and then
> output each returned bar as usual.
>
> The documentation for DATE_FORMAT has a list of all of the specifiers, but
> the above should get you the output in mmddYYYY.
> <http://www.mysql.com/doc/en/Date_and_time_functions.html>
>
> hth,
>
> ~kinu panda

Thanx, that will do.

Rob

--
http://www.onp.nl
 
Barel Yoav





PostPosted: 2003-10-19 23:36:00 Top

java-programmer >> date format When I bing data from SQL Servert DB to textbox it's display the date filed
with strange format.
How can I format the dates field when I bind dataset to a control ?


 
 
Eliyahu Goldin





PostPosted: 2003-10-20 0:13:00 Top

java-programmer >> date format Use data-binding expression with format string like this:

<asp:TextBox id=textBoxForDate runat="server" Text='<%#
DataBinder.Eval(myDataSet, "Tables[myTable].DefaultView.[0].BeginDate",
"{0:yyyy-MMMM-dd}") %>'></asp:TextBox>

Eliyahu

"Barel Yoav" <email***@***.com> wrote in message
news:%23r$email***@***.com...
> When I bing data from SQL Servert DB to textbox it's display the date
filed
> with strange format.
> How can I format the dates field when I bind dataset to a control ?
>
>


 
 
Natty Gur





PostPosted: 2003-10-20 0:52:00 Top

java-programmer >> date format Hi,

You can use SQL server Convert function [1] to format the date as you
want.

[1] -
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/tsqlref
/ts_ca-co_2f3o.asp

Natty Gur[MVP]
Phone Numbers:
Office: +972-(0)9-7740261
Fax: +972-(0)9-7740261
Mobile: +972-(0)58-888377


*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
 
 
Mauricio





PostPosted: 2003-12-2 20:01:00 Top

java-programmer >> date format In my webform has a text box bound with a DataSet's column
which type is DateTime.
I have 2 troubles:
- I want to show only date, but it's showing date and
time.
- I want to show date in format dd/mm/yyyy, but it's
showing mm/dd/yyyy.
Anyone can help me?

Thanks.

 
 
Pete





PostPosted: 2003-12-2 20:09:00 Top

java-programmer >> date format You could try....

theDateTimeObject.ToString("dd/MM/yyyy")

Pete

"Mauricio" <email***@***.com> wrote in message
news:b0fc01c3b8cc$014a46b0$email***@***.com...
> In my webform has a text box bound with a DataSet's column
> which type is DateTime.
> I have 2 troubles:
> - I want to show only date, but it's showing date and
> time.
> - I want to show date in format dd/mm/yyyy, but it's
> showing mm/dd/yyyy.
> Anyone can help me?
>
> Thanks.
>


 
 
Pete





PostPosted: 2003-12-2 20:14:00 Top

java-programmer >> date format Or of course if I'd read the question correctly....

You'd probably be better using something like:

<%# DataBinder.Eval(Container.DataItem, "OrderDate", "{0:dd/MM/yyyy}" ) %>


"Pete" <peted at freenet co uk> wrote in message
news:%2311$email***@***.com...
> You could try....
>
> theDateTimeObject.ToString("dd/MM/yyyy")
>
> Pete
>
> "Mauricio" <email***@***.com> wrote in message
> news:b0fc01c3b8cc$014a46b0$email***@***.com...
> > In my webform has a text box bound with a DataSet's column
> > which type is DateTime.
> > I have 2 troubles:
> > - I want to show only date, but it's showing date and
> > time.
> > - I want to show date in format dd/mm/yyyy, but it's
> > showing mm/dd/yyyy.
> > Anyone can help me?
> >
> > Thanks.
> >
>
>


 
 
Jaydeep





PostPosted: 2003-12-2 21:22:00 Top

java-programmer >> date format For the first problem you can use ToShortDateString method of DateTime
object
for the second problem you can use <%# DataBinder.Eval(Container.DataItem,
"OrderDate", "{0:dd/MM/yyyy}" ) %>


 
 
Mauricio





PostPosted: 2003-12-3 19:40:00 Top

java-programmer >> date format Hi Pete,

How can I execute theDateTimeObject.ToString("dd/MM/yyyy")
if the text box is bound with a date column?

Best Regards,
Mauricio

>-----Mensagem original-----
>You could try....
>
>theDateTimeObject.ToString("dd/MM/yyyy")
>
>Pete
>
>"Mauricio" <email***@***.com> wrote in
message
>news:b0fc01c3b8cc$014a46b0$email***@***.com...
>> In my webform has a text box bound with a DataSet's
column
>> which type is DateTime.
>> I have 2 troubles:
>> - I want to show only date, but it's showing date
and
>> time.
>> - I want to show date in format dd/mm/yyyy, but it's
>> showing mm/dd/yyyy.
>> Anyone can help me?
>>
>> Thanks.
>>
>
>
>.
>
 
 
Jagan Mohan





PostPosted: 2003-12-3 20:02:00 Top

java-programmer >> date format In the DataBind event of the DataGrid, Place you code to convert the format.

private void dg_DataBind(object, e)
{
e.Items[3].Value = ((System.DateTime) e.Items[3]).ToString("dd/MM/yyyy",
System.Globalization.DateTimeFormatInfo.InvariantInfo)
}

Thanks,
Jagan Mohan
MCP

"Mauricio" <email***@***.com> wrote in message
news:089c01c3b992$484dd510$email***@***.com...
> Hi Pete,
>
> How can I execute theDateTimeObject.ToString("dd/MM/yyyy")
> if the text box is bound with a date column?
>
> Best Regards,
> Mauricio
>
> >-----Mensagem original-----
> >You could try....
> >
> >theDateTimeObject.ToString("dd/MM/yyyy")
> >
> >Pete
> >
> >"Mauricio" <email***@***.com> wrote in
> message
> >news:b0fc01c3b8cc$014a46b0$email***@***.com...
> >> In my webform has a text box bound with a DataSet's
> column
> >> which type is DateTime.
> >> I have 2 troubles:
> >> - I want to show only date, but it's showing date
> and
> >> time.
> >> - I want to show date in format dd/mm/yyyy, but it's
> >> showing mm/dd/yyyy.
> >> Anyone can help me?
> >>
> >> Thanks.
> >>
> >
> >
> >.
> >


 
 
Tracey





PostPosted: 2003-12-10 21:52:00 Top

java-programmer >> date format I have a web page that worked fine in development with the
date format but now I have deployed it to my live web
server whenever you add a date it switches the day and
month around.
For example, 10th December 2003 entered as 10/12/03 would
be saved in a Microsoft Access database as 12/10/03. I
have checked my regional settings in Control Panel and
they would appear to be set correctly but is there
anywhere else I should be checking. I don't understand why
it would work fine on my pc but not on the web server.
Can anyone help me??
 
 
Mike Smith





PostPosted: 2003-12-10 23:59:00 Top

java-programmer >> date format did u ask the web server ppl whats their regional settings ? think they
using m/d/y format
i had the same problems with my web server.

"Tracey" <email***@***.com> wrote in message
news:058001c3bf24$de9ec1e0$email***@***.com...
> I have a web page that worked fine in development with the
> date format but now I have deployed it to my live web
> server whenever you add a date it switches the day and
> month around.
> For example, 10th December 2003 entered as 10/12/03 would
> be saved in a Microsoft Access database as 12/10/03. I
> have checked my regional settings in Control Panel and
> they would appear to be set correctly but is there
> anywhere else I should be checking. I don't understand why
> it would work fine on my pc but not on the web server.
> Can anyone help me??


 
 
simon





PostPosted: 2004-2-9 18:24:00 Top

java-programmer >> date format I have virtual directory where I run test.asp page with only this code
inside:
<%Response.Write now()%>

As a result, if I go into the IE and browse for the test.asp page, I get :
1/22/2004 14:18:04

If I copy this page on some other(existing) virtual directory, I get as a
result
22.1.2004 14:19:06

If I create a new virtual directory and I copy the page there, I get :
1/22/2004 14:18:04

Seems like that IIS takes english date format even if my regional setting is
:
d.M.yyyy and I would like that date on the page is always like this:
22.1.2004 14:19:06

Where I can change this setting?
Is there some bug in IIS?

Thank you,
Simon


 
 
Bob Barrows





PostPosted: 2004-2-9 20:01:00 Top

java-programmer >> date format simon wrote:
> I have virtual directory where I run test.asp page with only this code
> inside:
> <%Response.Write now()%>
>
> As a result, if I go into the IE and browse for the test.asp page, I
> get : 1/22/2004 14:18:04
>
> If I copy this page on some other(existing) virtual directory, I get
> as a result
> 22.1.2004 14:19:06
>
> If I create a new virtual directory and I copy the page there, I get :
> 1/22/2004 14:18:04
>
> Seems like that IIS takes english date format even if my regional
> setting is
>>
> d.M.yyyy and I would like that date on the page is always like this:
> 22.1.2004 14:19:06
>
> Where I can change this setting?
> Is there some bug in IIS?
>
> Thank you,
> Simon

http://www.aspfaq.com/show.asp?id=2260

This site has a couple more articles devoted to formatting dates so you
should use the Search tool to find them.

HTH,
Bob Barrows

--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"


 
 
simon





PostPosted: 2004-2-9 21:48:00 Top

java-programmer >> date format hi, thank you for your link, I read all about it.

If I use: session.LCID=1060 (which is Slovenian lcid) I still get the
american or similar format (mm/dd/yyyy).

If I use session.LCID=1031 (which is German) than the date is changed
(dd.mm.yyyy).

It somehowe takes that the slovenian format is like english. Why?

I looked at registry:
HKEY_CURRENT_USER\Control Panel\International

and all settings are ok, they are slovenian like they should be.

And in windows everything is fine, only on the asp page is wrong format.

So, where could be the problem?

Thank you,
Simon

"Bob Barrows" <email***@***.com> wrote in message
news:email***@***.com...
> simon wrote:
> > I have virtual directory where I run test.asp page with only this code
> > inside:
> > <%Response.Write now()%>
> >
> > As a result, if I go into the IE and browse for the test.asp page, I
> > get : 1/22/2004 14:18:04
> >
> > If I copy this page on some other(existing) virtual directory, I get
> > as a result
> > 22.1.2004 14:19:06
> >
> > If I create a new virtual directory and I copy the page there, I get :
> > 1/22/2004 14:18:04
> >
> > Seems like that IIS takes english date format even if my regional
> > setting is
> >>
> > d.M.yyyy and I would like that date on the page is always like this:
> > 22.1.2004 14:19:06
> >
> > Where I can change this setting?
> > Is there some bug in IIS?
> >
> > Thank you,
> > Simon
>
> http://www.aspfaq.com/show.asp?id=2260
>
> This site has a couple more articles devoted to formatting dates so you
> should use the Search tool to find them.
>
> HTH,
> Bob Barrows
>
> --
> Microsoft MVP - ASP/ASP.NET
> Please reply to the newsgroup. This email account is my spam trap so I
> don't check it very often. If you must reply off-line, then remove the
> "NO SPAM"
>
>


 
 
Aaron Bertrand - MVP





PostPosted: 2004-2-9 21:53:00 Top

java-programmer >> date format Obviously, someone messed up your regional settings. So, instead of relying
on them, format your dates manually.
http://www.aspfaq.com/2313

(Or, show them in an unambiguous format, e.g. yyyy-mm-dd)

--
Aaron Bertrand
SQL Server MVP
http://www.aspfaq.com/




"simon" <email***@***.com> wrote in message
news:email***@***.com...
> hi, thank you for your link, I read all about it.
>
> If I use: session.LCID=1060 (which is Slovenian lcid) I still get the
> american or similar format (mm/dd/yyyy).
>
> If I use session.LCID=1031 (which is German) than the date is changed
> (dd.mm.yyyy).
>
> It somehowe takes that the slovenian format is like english. Why?
>
> I looked at registry:
> HKEY_CURRENT_USER\Control Panel\International
>
> and all settings are ok, they are slovenian like they should be.
>
> And in windows everything is fine, only on the asp page is wrong format.
>
> So, where could be the problem?
>
> Thank you,
> Simon
>
> "Bob Barrows" <email***@***.com> wrote in message
> news:email***@***.com...
> > simon wrote:
> > > I have virtual directory where I run test.asp page with only this code
> > > inside:
> > > <%Response.Write now()%>
> > >
> > > As a result, if I go into the IE and browse for the test.asp page, I
> > > get : 1/22/2004 14:18:04
> > >
> > > If I copy this page on some other(existing) virtual directory, I get
> > > as a result
> > > 22.1.2004 14:19:06
> > >
> > > If I create a new virtual directory and I copy the page there, I get :
> > > 1/22/2004 14:18:04
> > >
> > > Seems like that IIS takes english date format even if my regional
> > > setting is
> > >>
> > > d.M.yyyy and I would like that date on the page is always like this:
> > > 22.1.2004 14:19:06
> > >
> > > Where I can change this setting?
> > > Is there some bug in IIS?
> > >
> > > Thank you,
> > > Simon
> >
> > http://www.aspfaq.com/show.asp?id=2260
> >
> > This site has a couple more articles devoted to formatting dates so you
> > should use the Search tool to find them.
> >
> > HTH,
> > Bob Barrows
> >
> > --
> > Microsoft MVP - ASP/ASP.NET
> > Please reply to the newsgroup. This email account is my spam trap so I
> > don't check it very often. If you must reply off-line, then remove the
> > "NO SPAM"
> >
> >
>
>


 
 
Bullschmidt





PostPosted: 2004-2-10 17:39:00 Top

java-programmer >> date format To make a variable be in the format of yyyy-mm-dd (and the final line of
code can be modifed for other date formats), perhaps try something like
the following which you might even make into a function:

varFld = CDate(MyVariable)

intMonth = Month(varFld)
intDay = Day(varFld)
intYr = Year(varFld)

If intMonth < 10 Then
strMonth = "0" & CStr(intMonth)
Else
strMonth = CStr(intMonth)
End If

If intDay < 10 Then
strDay = "0" & CStr(intDay)
Else
strDay = CStr(intDay)
End If

varFld = CStr(intYr & "-" & strMonth & "-" & strDay)

Best regards,
J. Paul Schmidt, Freelance ASP Web Developer
http://www.Bullschmidt.com
ASP Design Tips, ASP Web Database Demo, Free ASP Bar Chart Tool...


*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
 
 
Greg





PostPosted: 2004-5-21 1:41:00 Top

java-programmer >> date format What's the best format for adding a date to a table? I was using "20040520
10:39:31", but now it's giving me the error: '20040520 10:39:31' is not a
valid date and time.


 
 
Greg





PostPosted: 2004-5-21 1:48:00 Top

java-programmer >> date format "Greg" <email***@***.com> wrote in message
news:d56rc.349$0d6.298@lakeread03...
> What's the best format for adding a date to a table? I was using
"20040520
> 10:39:31", but now it's giving me the error: '20040520 10:39:31' is not a
> valid date and time.
>

Oops, it was my fault. It wasn't a MySQL error.