Stan
|
Posted: 12/02/2005, 12:53 AM |
|
You should parse this string, using the following format "yyyyMMdd"
DateTime val = DateTime.ParseExact("20051127","yyyyMMdd", System.Globalization.CultureInfo.CurrentCulture);
Or you can use CCS built-in classes
DateField val = new DateField("yyyyMMdd", "20051127");
Then format it
string sVal = val.ToString("MM/dd/yyyy");
or
string sVal = val.GetFormattedValue("MM/dd/yyyy");
|
Guillermo
Posts: 14
|
Posted: 12/02/2005, 9:48 AM |
|
Hello,
Thanks for the replies... unfortunate I got these errors when compiling the page.
When I use:
DateTime val = DateTime.ParseExact("20051127","yyyyMMdd", System.Globalization.CultureInfo.CurrentCulture);
Error:
M:\DrogueriaCentral_NET\Backups>REM _MakeAll @1-2EF97579
C:\DOCUME~1\GUILLE~1\LOCALS~1\Temp\~DROGU~1>C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\vbc /rootnamespace:DrogueriaCentral_NET /t:library /out:bin\DrogueriaCentral_NET.dll /imports:System.Data.OracleClient /r:System.Data.OracleClient.dll /imports:Microsoft.VisualBasic,System,System.Web,System.Xml,System.Data,System.Drawing /r:Microsoft.VisualBasic.dll,System.dll,System.Web.dll,System.Xml.dll,System.Data.dll,System.Drawing.dll /recurse:*.vb
Microsoft (R) Visual Basic .NET Compiler version 7.10.3052.4
for Microsoft (R) .NET Framework version 1.1.4322.573
Copyright (C) Microsoft Corporation 1987-2002. All rights reserved.
C:\DOCUME~1\GUILLE~1\LOCALS~1\Temp\~DROGU~1\AccountInfo.aspx.vb(69) : error BC30684: 'DateTime' is a type and cannot be used as an expression.
DateTime val = DateTime.ParseExact("20051127","yyyyMMdd", System.Globalization.CultureInfo.CurrentCulture);
~~~~~~~~
C:\DOCUME~1\GUILLE~1\LOCALS~1\Temp\~DROGU~1\AccountInfo.aspx.vb(69) : error BC30800: Method arguments must be enclosed in parentheses.
DateTime val = DateTime.ParseExact("20051127","yyyyMMdd", System.Globalization.CultureInfo.CurrentCulture);
~~~
C:\DOCUME~1\GUILLE~1\LOCALS~1\Temp\~DROGU~1\AccountInfo.aspx.vb(69) : error BC30516: Overload resolution failed because no accessible 'Val' accepts this number of arguments.
DateTime val = DateTime.ParseExact("20051127","yyyyMMdd", System.Globalization.CultureInfo.CurrentCulture);
~~~
C:\DOCUME~1\GUILLE~1\LOCALS~1\Temp\~DROGU~1\AccountInfo.aspx.vb(69) : error BC30037: Character is not valid.
DateTime val = DateTime.ParseExact("20051127","yyyyMMdd", System.Globalization.CultureInfo.CurrentCulture);
~
C:\DOCUME~1\GUILLE~1\LOCALS~1\Temp\~DROGU~1>REM _End MakeAll
When I use:
DateField val = new DateField("yyyyMMdd", "20051127");
string sVal = val.ToString("MM/dd/yyyy");
or
string sVal = val.GetFormattedValue("MM/dd/yyyy");
Error:
M:\DrogueriaCentral_NET\Backups>REM _MakeAll @1-2EF97579
C:\DOCUME~1\GUILLE~1\LOCALS~1\Temp\~DROGU~1>C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\vbc /rootnamespace:DrogueriaCentral_NET /t:library /out:bin\DrogueriaCentral_NET.dll /imports:System.Data.OracleClient /r:System.Data.OracleClient.dll /imports:Microsoft.VisualBasic,System,System.Web,System.Xml,System.Data,System.Drawing /r:Microsoft.VisualBasic.dll,System.dll,System.Web.dll,System.Xml.dll,System.Data.dll,System.Drawing.dll /recurse:*.vb
Microsoft (R) Visual Basic .NET Compiler version 7.10.3052.4
for Microsoft (R) .NET Framework version 1.1.4322.573
Copyright (C) Microsoft Corporation 1987-2002. All rights reserved.
C:\DOCUME~1\GUILLE~1\LOCALS~1\Temp\~DROGU~1\AccountInfo.aspx.vb(69) : error BC30684: 'DateField' is a type and cannot be used as an expression.
DateField val = new DateField("yyyyMMdd", "20051127");
~~~~~~~~~
C:\DOCUME~1\GUILLE~1\LOCALS~1\Temp\~DROGU~1\AccountInfo.aspx.vb(69) : error BC30800: Method arguments must be enclosed in parentheses.
DateField val = new DateField("yyyyMMdd", "20051127");
~~~
C:\DOCUME~1\GUILLE~1\LOCALS~1\Temp\~DROGU~1\AccountInfo.aspx.vb(69) : error BC30516: Overload resolution failed because no accessible 'Val' accepts this number of arguments.
DateField val = new DateField("yyyyMMdd", "20051127");
~~~
C:\DOCUME~1\GUILLE~1\LOCALS~1\Temp\~DROGU~1\AccountInfo.aspx.vb(69) : error BC30037: Character is not valid.
DateField val = new DateField("yyyyMMdd", "20051127");
~
C:\DOCUME~1\GUILLE~1\LOCALS~1\Temp\~DROGU~1\AccountInfo.aspx.vb(71) : error BC30109: 'String' is a class type, and so is not a valid expression.
string sVal = val.GetFormattedValue("MM/dd/yyyy");
~~~~~~
C:\DOCUME~1\GUILLE~1\LOCALS~1\Temp\~DROGU~1\AccountInfo.aspx.vb(71) : error BC30287: '.' expected.
string sVal = val.GetFormattedValue("MM/dd/yyyy");
~~~~
C:\DOCUME~1\GUILLE~1\LOCALS~1\Temp\~DROGU~1\AccountInfo.aspx.vb(71) : error BC30516: Overload resolution failed because no accessible 'Val' accepts this number of arguments.
string sVal = val.GetFormattedValue("MM/dd/yyyy");
~~~
C:\DOCUME~1\GUILLE~1\LOCALS~1\Temp\~DROGU~1>REM _End MakeAll
Any ideas?
|