This is regarding VB.NET 2003.
Variable 'Date' is a string and it contains date information in this
format: "DEC/05/2007".
Now I am trying to convert the format as "2007-12-05".
Is it possible to convert the arrangement using 'Format' method?
If so, please educate me how I can do such operation.
Thank you! 4 4528 th*********@gma il.com wrote:
Variable 'Date' is a string ...
.... which is a /lousy/ name for a String variable, BTW ...
(Hang on! Isn't "Date" [still] a reserved word??)
... and it contains date information in this format:
"DEC/05/2007".
Now I am trying to convert the format as "2007-12-05".
? DateTime.ParseE xact( "MMM/dd/yyyy" ).ToString( "yyyy-MM-dd" )
will work, so long as your in an English or French-speaking Locale; you
/might/ have problems elsewhere in the World.
Is it possible to convert the arrangement using 'Format' method?
Not directly.
Format() will take a DateTime variable and convert it into a String but
it can't take a String (in a non-standard date format) and do anything
useful with it.
Just out of curiosity, where did you get the data in that format
(MMM/dd/yyyy") /from/? I don't think I've ever seen that one before.
HTH,
Phill W.
A straight string manipulation will do it, if you aren't doing any date
arithmetic.
Just use the Mid() function and translate the month names to a numeral.
If you are doing date arithmetic, then use the DateSerial() function after
converting the month name.
--
David Streeter
Synchrotech Software
Sydney Australia
"th*********@gm ail.com" wrote:
This is regarding VB.NET 2003.
Variable 'Date' is a string and it contains date information in this
format: "DEC/05/2007".
Now I am trying to convert the format as "2007-12-05".
Is it possible to convert the arrangement using 'Format' method?
If so, please educate me how I can do such operation.
Thank you!
DateTime.ParseE xact(StrConv([Date], VbStrConv.Prope rCase), "MMM/dd/yyyy",
CultureInfo.Inv ariantCulture). ToString("yyyy-MM-dd")
Note the use of StrConv([Date], VbStrConv.Prope rCase) to change DEC to Dec,
otherwise the DateTime.ParseE xact won't work correctly.
<th*********@gm ail.comwrote in message
news:94******** *************** ***********@t1g 2000pra.googleg roups.com...
This is regarding VB.NET 2003.
Variable 'Date' is a string and it contains date information in this
format: "DEC/05/2007".
Now I am trying to convert the format as "2007-12-05".
Is it possible to convert the arrangement using 'Format' method?
If so, please educate me how I can do such operation.
Thank you!
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Simon Brooke |
last post by:
I'm investigating a bug a customer has reported in our database
abstraction layer, and it's making me very unhappy.
Brief summary:
I have a database abstraction layer which is intended to mediate
between webapps and arbitrary database backends using JDBC. I am very
unwilling indeed to write special-case code for particular
databases. Our code has worked satisfactorily with many databases,
including many instances MS SQLServer 2000...
|
by: DC Gringo |
last post by:
How can I convert this pubLatest to a date with format "m/d/yyyy"?
Dim pubLatest As New Date
pubLatest = Me.SqlSelectCommand1.Parameters("@pubLatest").Value
--
_____
DC G
|
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: abcabcabc |
last post by:
I write an application which can let user define own date format to input,
How to convert the date string to date value with end-user defined date
format?
Example, User Defined Date Format as "dd/MM/yyyy"
input as "01082003" convert to date value as, 01 Aug 2003
Example, User Defined Date Format as "yyyy,dd,MM"
|
by: Bob Sanderson |
last post by:
I have a field in a database called DateRcvd. At present, it outputs in my
report in the yyyy-mm-dd format. I would like it to display in the dd/mm/yy
format. What is the easiest way to accomplish this?
| |
by: bonnie.tangyn |
last post by:
Dear all
In my ASP page, user can enter date in dd/mm/yyyy format. How can I use
Javascript to convert dd/mm/yyyy to yyyy-mm-dd hh:mm:ss.
Please give me some advices.
Cheers
Bon
|
by: Alok yadav |
last post by:
i am using a webservice in which a method is serach. i use this method
which accept a argument of date type in dd/MM/yyyy formate. i have a
textbox which accept the date from the user, when i convert textbox data
into Datatime formate it converted into MM/dd/yyyy formate, but i have a
requirement in dd/MM/yyyy formate.
please help me, i am using c#.
|
by: thewilldog |
last post by:
Hello, I've reviewed the archives here to address the issue, but I'm still running into problems. I've got a table field populated with the record date in text "YYYYMMDD"
To convert it into a recognizable date format, I've done the following:
Query 1: References Source Table; Isolates Year, Day; creates MMDD field
Acc Open Year: Left(,4)
Acc Open Day: Right(,2)
MMDD: Right(,4)
Query 2: References Query 1; Isolates Month
|
by: pamela fluente |
last post by:
Hi,
I wish to create a string from the current date now() so that it looks
like
the format used by Excel, for instance:
2006-04-16T19:45:42Z
How would I achieve that?
|
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: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
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: 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: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
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: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
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...
| |