Crossposted:
microsoft.publi c.dotnet.langua ges.vb
microsoft.publi c.sqlserver.int egrationsvcs
Hello all,
In XL 2003's VBA, I could use the format function to change "11SEP2008" (a
string) to "11-SEP-2008" (another string) like so:
Format("11SEP20 08", "@@-@@@-@@@@")
That doesn't seem to be the case in VB.NET. When I tried the same thing, I
got "@@-@@@-@@@@" instead of "11-SEP-2008".
What would be the equivalent in VB.NET?
In SQL Server 2005 SSIS, I need to import fixed-width flat files with
string/text dates in the format of "ddmmmyyyy" , but string/text dates in
that format can not be implicitly cast to
smalldatetime/DT_DBTIMESTAMP/DT_DBDATE. If I remember correctly, can't
"dd-mmm-yyyy" be implicitly cast? I have a script component transformation
in my data flow. I was trying to use the format function above to change
"ddmmmyyyy" to "dd-mmm-yyyy" in the script tranformation, but no workie!!!
For now, I guess I'll have to use Right(), Mid(), and Left() and concatenate
with hyphens.
Thanks for any help anyone can provide,
Conan Kelly
---------------------------
"Smokin' weed kills your brain cells. Drinkin' only screws up your
liver...ya got 2 a those."
- Earl Hickey (NBC's "My Name is Earl") 8 5116
"Conan Kelly" <CT************ **@msnNOSPAM.co mNOSPAMa écrit dans le message
de news: eM************* *@TK2MSFTNGP06. phx.gbl...
Crossposted:
microsoft.publi c.dotnet.langua ges.vb
microsoft.publi c.sqlserver.int egrationsvcs
Hello all,
In XL 2003's VBA, I could use the format function to change "11SEP2008" (a
string) to "11-SEP-2008" (another string) like so:
Format("11SEP20 08", "@@-@@@-@@@@")
That doesn't seem to be the case in VB.NET. When I tried the same thing,
I got "@@-@@@-@@@@" instead of "11-SEP-2008".
What would be the equivalent in VB.NET?
Format("11SEP20 08", "##-###-####") perhaps?
Conan,
There are endless posibilities in VB.
I do it mostly like this.
\\\
Dim seDate = CDate("12sep200 8").ToString("d d-MMM-yyyy")
///
Cor
"Conan Kelly" <CT************ **@msnNOSPAM.co mNOSPAMschreef in bericht
news:eM******** ******@TK2MSFTN GP06.phx.gbl...
Crossposted:
microsoft.publi c.dotnet.langua ges.vb
microsoft.publi c.sqlserver.int egrationsvcs
Hello all,
In XL 2003's VBA, I could use the format function to change "11SEP2008" (a
string) to "11-SEP-2008" (another string) like so:
Format("11SEP20 08", "@@-@@@-@@@@")
That doesn't seem to be the case in VB.NET. When I tried the same thing,
I got "@@-@@@-@@@@" instead of "11-SEP-2008".
What would be the equivalent in VB.NET?
In SQL Server 2005 SSIS, I need to import fixed-width flat files with
string/text dates in the format of "ddmmmyyyy" , but string/text dates in
that format can not be implicitly cast to
smalldatetime/DT_DBTIMESTAMP/DT_DBDATE. If I remember correctly, can't
"dd-mmm-yyyy" be implicitly cast? I have a script component
transformation in my data flow. I was trying to use the format function
above to change "ddmmmyyyy" to "dd-mmm-yyyy" in the script tranformation,
but no workie!!! For now, I guess I'll have to use Right(), Mid(), and
Left() and concatenate with hyphens.
Thanks for any help anyone can provide,
Conan Kelly
---------------------------
"Smokin' weed kills your brain cells. Drinkin' only screws up your
liver...ya got 2 a those."
- Earl Hickey (NBC's "My Name is Earl")
Clive,
Thanks for the feedback, but sorry...no workie!!!
Just like using the "at" symbol, my results for your suggestion was
"##-###-####" instead of "11-SEP-2008".
Also, isn't the pound/number sign meant for digits? Wouldn't you use it to
change how a number is displayed? Something like this:
Format(pdblTota lBalance, "#,##0.00") . Do the pound/number signs even work
with string data? If they do, they might work for all the digits in the
string, but I'm guessing that they wouldn't know what to do with the "SEP"
part of the string.
Thanks again for all of your help,
Conan
"Clive Lumb" <clumb2@gratuit _en_anglais.fr. invalidwrote in message
news:48******** *************** @news.free.fr.. .
>
"Conan Kelly" <CT************ **@msnNOSPAM.co mNOSPAMa écrit dans le
message de news: eM************* *@TK2MSFTNGP06. phx.gbl...
>Crossposted: microsoft.publ ic.dotnet.langu ages.vb microsoft.publ ic.sqlserver.in tegrationsvcs Hello all,
In XL 2003's VBA, I could use the format function to change "11SEP2008" (a string) to "11-SEP-2008" (another string) like so:
Format("11SEP2 008", "@@-@@@-@@@@")
That doesn't seem to be the case in VB.NET. When I tried the same thing, I got "@@-@@@-@@@@" instead of "11-SEP-2008".
What would be the equivalent in VB.NET?
Format("11SEP20 08", "##-###-####") perhaps?
Cor,
Thanks for the feedback. I'll try it out.
Although, it is not exactly what I had in mind. Take a date as a string
data type, convert it to a date data type, then to a string data type in the
desired format, just so it can be imported (converted again) into a
smalldatetime column in a database. That is a lot of converting. But I
guess you gotta go with what works.
Will VB.NET recognize "12SEP2008" as a date and convert it, or does it need
the hyphens in there ("12-SEP-2008")? I guess I'll find out in a couple of
minutes.
Thanks again for all of your help,
Conan
"Cor Ligthert[MVP]" <no************ @planet.nlwrote in message
news:67******** *************** ***********@mic rosoft.com...
Conan,
There are endless posibilities in VB.
I do it mostly like this.
\\\
Dim seDate = CDate("12sep200 8").ToString("d d-MMM-yyyy")
///
Cor
"Conan Kelly" <CT************ **@msnNOSPAM.co mNOSPAMschreef in bericht
news:eM******** ******@TK2MSFTN GP06.phx.gbl...
>Crossposted: microsoft.publ ic.dotnet.langu ages.vb microsoft.publ ic.sqlserver.in tegrationsvcs Hello all,
In XL 2003's VBA, I could use the format function to change "11SEP2008" (a string) to "11-SEP-2008" (another string) like so:
Format("11SEP2 008", "@@-@@@-@@@@")
That doesn't seem to be the case in VB.NET. When I tried the same thing, I got "@@-@@@-@@@@" instead of "11-SEP-2008".
What would be the equivalent in VB.NET?
In SQL Server 2005 SSIS, I need to import fixed-width flat files with string/text dates in the format of "ddmmmyyyy" , but string/text dates in that format can not be implicitly cast to smalldatetim e/DT_DBTIMESTAMP/DT_DBDATE. If I remember correctly, can't "dd-mmm-yyyy" be implicitly cast? I have a script component transformati on in my data flow. I was trying to use the format function above to change "ddmmmyyyy" to "dd-mmm-yyyy" in the script tranformation, but no workie!!! For now, I guess I'll have to use Right(), Mid(), and Left() and concatenate with hyphens.
Thanks for any help anyone can provide,
Conan Kelly --------------------------- "Smokin' weed kills your brain cells. Drinkin' only screws up your liver...ya got 2 a those." - Earl Hickey (NBC's "My Name is Earl")
Cor,
Looks like it worked okay.
Just out of curiosity, why would the at symbol (@) work in VBA but not
VB.NET? Doesn't make sense.
Thanks again,
Conan
"Conan Kelly" <CT************ **@msnNOSPAM.co mNOSPAMwrote in message
news:u%******** *******@TK2MSFT NGP02.phx.gbl.. .
Cor,
Thanks for the feedback. I'll try it out.
Although, it is not exactly what I had in mind. Take a date as a string
data type, convert it to a date data type, then to a string data type in
the desired format, just so it can be imported (converted again) into a
smalldatetime column in a database. That is a lot of converting. But I
guess you gotta go with what works.
Will VB.NET recognize "12SEP2008" as a date and convert it, or does it
need the hyphens in there ("12-SEP-2008")? I guess I'll find out in a
couple of minutes.
Thanks again for all of your help,
Conan
"Cor Ligthert[MVP]" <no************ @planet.nlwrote in message
news:67******** *************** ***********@mic rosoft.com...
>Conan,
There are endless posibilities in VB.
I do it mostly like this.
\\\ Dim seDate = CDate("12sep200 8").ToString("d d-MMM-yyyy") ///
Cor "Conan Kelly" <CT************ **@msnNOSPAM.co mNOSPAMschreef in bericht news:eM******* *******@TK2MSFT NGP06.phx.gbl.. .
>>Crossposted : microsoft.pub lic.dotnet.lang uages.vb microsoft.pub lic.sqlserver.i ntegrationsvcs Hello all,
In XL 2003's VBA, I could use the format function to change "11SEP2008" (a string) to "11-SEP-2008" (another string) like so:
Format("11SEP 2008", "@@-@@@-@@@@")
That doesn't seem to be the case in VB.NET. When I tried the same thing, I got "@@-@@@-@@@@" instead of "11-SEP-2008".
What would be the equivalent in VB.NET?
In SQL Server 2005 SSIS, I need to import fixed-width flat files with string/text dates in the format of "ddmmmyyyy" , but string/text dates in that format can not be implicitly cast to smalldateti me/DT_DBTIMESTAMP/DT_DBDATE. If I remember correctly, can't "dd-mmm-yyyy" be implicitly cast? I have a script component transformatio n in my data flow. I was trying to use the format function above to change "ddmmmyyyy" to "dd-mmm-yyyy" in the script tranformation , but no workie!!! For now, I guess I'll have to use Right(), Mid(), and Left() and concatenate with hyphens.
Thanks for any help anyone can provide,
Conan Kelly --------------------------- "Smokin' weed kills your brain cells. Drinkin' only screws up your liver...ya got 2 a those." - Earl Hickey (NBC's "My Name is Earl")
Hello Conan,
Conan Kelly wrote:
>
Just out of curiosity, why would the at symbol (@) work in VBA but not
VB.NET? Doesn't make sense.
VBA is not VB.NET, .NET has its own syntax for format
strings which significant differences to the VBA version.
For more detail about .NET format strings see: http://msdn.microsoft.com/en-us/libr...sy(VS.80).aspx
regards,
Gerald
Hi Conan,
Indeed no workee, sorry I was going to check then my VS2008 broked.
This could be quite an elegant solution...
Public Function dFormat(ByRef DateString As String) As String
Try
dFormat = DateString.Inse rt(2, "-").Insert(6 , "-")
Catch
dFormat = "Length N/A"
End Try
End Function
"Conan Kelly" <CT************ **@msnNOSPAM.co mNOSPAMa écrit dans le message
de news: O$************* @TK2MSFTNGP05.p hx.gbl...
Clive,
Thanks for the feedback, but sorry...no workie!!!
Just like using the "at" symbol, my results for your suggestion was
"##-###-####" instead of "11-SEP-2008".
Also, isn't the pound/number sign meant for digits? Wouldn't you use it
to change how a number is displayed? Something like this:
Format(pdblTota lBalance, "#,##0.00") . Do the pound/number signs even work
with string data? If they do, they might work for all the digits in the
string, but I'm guessing that they wouldn't know what to do with the "SEP"
part of the string.
Thanks again for all of your help,
Conan
"Clive Lumb" <clumb2@gratuit _en_anglais.fr. invalidwrote in message
news:48******** *************** @news.free.fr.. .
>> "Conan Kelly" <CT************ **@msnNOSPAM.co mNOSPAMa écrit dans le message de news: eM************* *@TK2MSFTNGP06. phx.gbl...
>>Crossposted : microsoft.pub lic.dotnet.lang uages.vb microsoft.pub lic.sqlserver.i ntegrationsvcs Hello all,
In XL 2003's VBA, I could use the format function to change "11SEP2008" (a string) to "11-SEP-2008" (another string) like so:
Format("11SEP 2008", "@@-@@@-@@@@")
That doesn't seem to be the case in VB.NET. When I tried the same thing, I got "@@-@@@-@@@@" instead of "11-SEP-2008".
What would be the equivalent in VB.NET?
Format("11SEP2 008", "##-###-####") perhaps?
Clive,
Thanks again.
Cool...I'll have to save this post and try that the next time I run into
this issure again. I'm not verry familiar with VB.NET...more VB6 & VBA. I
did not know about the Insert ?function/method? for strings.
Thanks again for all of your help,
Conan
"Clive Lumb" <clumb2@gratuit _en_anglais.fr. invalidwrote in message
news:ew******** ******@TK2MSFTN GP04.phx.gbl...
Hi Conan,
Indeed no workee, sorry I was going to check then my VS2008 broked.
This could be quite an elegant solution...
Public Function dFormat(ByRef DateString As String) As String
Try
dFormat = DateString.Inse rt(2, "-").Insert(6 , "-")
Catch
dFormat = "Length N/A"
End Try
End Function
"Conan Kelly" <CT************ **@msnNOSPAM.co mNOSPAMa écrit dans le
message de news: O$************* @TK2MSFTNGP05.p hx.gbl...
>Clive,
Thanks for the feedback, but sorry...no workie!!!
Just like using the "at" symbol, my results for your suggestion was "##-###-####" instead of "11-SEP-2008".
Also, isn't the pound/number sign meant for digits? Wouldn't you use it to change how a number is displayed? Something like this: Format(pdblTot alBalance, "#,##0.00") . Do the pound/number signs even work with string data? If they do, they might work for all the digits in the string, but I'm guessing that they wouldn't know what to do with the "SEP" part of the string.
Thanks again for all of your help,
Conan
"Clive Lumb" <clumb2@gratuit _en_anglais.fr. invalidwrote in message news:48******* *************** *@news.free.fr. ..
>>> "Conan Kelly" <CT************ **@msnNOSPAM.co mNOSPAMa écrit dans le message de news: eM************* *@TK2MSFTNGP06. phx.gbl... Crossposte d: microsoft.pu blic.dotnet.lan guages.vb microsoft.pu blic.sqlserver. integrationsvcs Hello all,
In XL 2003's VBA, I could use the format function to change "11SEP2008" (a string) to "11-SEP-2008" (another string) like so:
Format("11SE P2008", "@@-@@@-@@@@")
That doesn't seem to be the case in VB.NET. When I tried the same thing, I got "@@-@@@-@@@@" instead of "11-SEP-2008".
What would be the equivalent in VB.NET?
Format("11SEP 2008", "##-###-####") perhaps?
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Melissa |
last post by:
What specifically causes the Format event of a report's section to fire?
Thanks!
Melissa
|
by: Jean |
last post by:
Hi,
I have a query that contains the following in the WHERE part of the
query:
WHERE....Format(IIf(nz()<>0,,
IIf(nz()<>0,,
IIf(nz()<>0,,
))),"0.0") AS Körperhöhe,....
|
by: Stuart McGraw |
last post by:
I am looking for a VBA "format" or "template" function, that is,
a function that takes a format string and a varying number of
arguments, and substitutes the argument values into the format
string as specified in the format string. For example
fmt("this is $1 format string. arg2 is $2", "short", 3)
would return the string
"this is short format string. arg2 is 3"
Now, the above is easy to write and I have done so. What I want
is...
|
by: Roy Hills |
last post by:
I've seen two different function prototype formats used for ANSI C,
and I'm unsure as to which is the correct or preferred one.
1st Format (this is what I use)
type function(type, type, type);
e.g. "int multiply(int, int);"
2nd Format (I've seen this used in other people's code)
|
by: Matt |
last post by:
I'm trying to write a shared function that will convert all my phone numbers
from format 1234567890 to (123) 456-7890.
Here is my function that I wrote:
Public Shared Function CheckPhone(byVal val as String) as String
dim strCheckPhone as String
If val = "" Then
strCheckPhone = ""
| |
by: KJ |
last post by:
Hello,
Why does this not work?
txtMoney.Text.Format("#,##0.00")
If I type 100 in txtMoney, it returns #,##0.00
I have never gotten the format function to work in .NET.
|
by: Ron |
last post by:
Hello,
The following code works in a Form class module but not a
standard module:
Dim d1 As DateTime
Format(d1, "MMMM")
In a standard module I get a squigly line saying that an
argument has not been specified for parameter format...
So I tried this:
|
by: Al Reid |
last post by:
First, I'm using vb2005. I have a string that is read from a barcode reader into a TextBox. The string is 6 characters long and
represents a date (mmddyy). I want to display it to the user in a date format of "mm/dd/yy" For example the barcode contains
"112303" and I want to format it to display "11/23/03"
If I use the microsoft.visualbasic.strings.format with a format string of "##/##/##" or "00/00/00" I get the format string in the...
|
by: sql guy123 |
last post by:
HI,
I'm pretty new to MS SQL,
My problem is setting ....
=Format$(Date(),"mm" & "/1/" & "YYYY")
(Which is from my MS ACCESS database)
|
by: shsandeep |
last post by:
I used the following query to retrieve the date in dd-mon-yyyy format.
db2 => SELECT RTRIM(CHAR(DAY(COVG_TYP_STRT_DT))) || '-' ||
RTRIM(MONTHNAME(COVG_TYP_STRT_DT)) || '-' ||
RTRIM(CHAR(YEAR(COVG_TYP_STRT_DT))) FROM twd_coverage_type
1
----------------------------------------------------------------------------------------------------------------------------
6-May-2006
1 record(s) selected.
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
| |
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
| |
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |