How can I convert this pubLatest to a date with format "m/d/yyyy"?
Dim pubLatest As New Date
pubLatest = Me.SqlSelectCommand1.Parameters("@pubLatest").Valu e
--
_____
DC G 12 2108
"DC Gringo" <dc******@visiontechnology.net> wrote in news:e2T7mLQlEHA.3968
@TK2MSFTNGP11.phx.gbl: How can I convert this pubLatest to a date with format "m/d/yyyy"?
Use the function FormatDateTime
--
Lucas Tam (RE********@rogers.com)
Please delete "REMOVE" from the e-mail address when replying. http://members.ebay.com/aboutme/coolspot18/
Thank you...
The only thing that did was set my time to 12:00
pubLatest =
FormatDateTime(Me.SqlSelectCommand1.Parameters("@p ubLatest").Value,
DateFormat.ShortDate)
______
DC G
"Lucas Tam" <RE********@rogers.com> wrote in message
news:Xn***************************@140.99.99.130.. . "DC Gringo" <dc******@visiontechnology.net> wrote in news:e2T7mLQlEHA.3968 @TK2MSFTNGP11.phx.gbl:
How can I convert this pubLatest to a date with format "m/d/yyyy"?
Use the function FormatDateTime
-- Lucas Tam (RE********@rogers.com) Please delete "REMOVE" from the e-mail address when replying. http://members.ebay.com/aboutme/coolspot18/
What variable type is pubLatest? Turn Option Strict On!!!
Greg
"DC Gringo" <dc******@visiontechnology.net> wrote in message
news:Og**************@TK2MSFTNGP09.phx.gbl... Thank you...
The only thing that did was set my time to 12:00
pubLatest = FormatDateTime(Me.SqlSelectCommand1.Parameters("@p ubLatest").Value, DateFormat.ShortDate)
______ DC G
"Lucas Tam" <RE********@rogers.com> wrote in message news:Xn***************************@140.99.99.130.. . "DC Gringo" <dc******@visiontechnology.net> wrote in news:e2T7mLQlEHA.3968 @TK2MSFTNGP11.phx.gbl:
> How can I convert this pubLatest to a date with format "m/d/yyyy"? >
Use the function FormatDateTime
-- Lucas Tam (RE********@rogers.com) Please delete "REMOVE" from the e-mail address when replying. http://members.ebay.com/aboutme/coolspot18/
Dim s As String = FormatDateTime(DateTime.Now, DateFormat.ShortDate)
s = "9/7/2004"
works for me
Greg
"Lucas Tam" <RE********@rogers.com> wrote in message
news:Xn***************************@140.99.99.130.. . "DC Gringo" <dc******@visiontechnology.net> wrote in news:OgmGIYQlEHA.1904 @TK2MSFTNGP09.phx.gbl:
Thank you...
The only thing that did was set my time to 12:00
I posted the wrong function...
Give Format a try.
http://msdn.microsoft.com/library/de...l=/library/en- us/vblr7/html/vafctformatdatetime.asp
-- Lucas Tam (RE********@rogers.com) Please delete "REMOVE" from the e-mail address when replying. http://members.ebay.com/aboutme/coolspot18/
Still no luck...neithr of these work...they both return times...
Could it be because of my declaration?
Public pubLatest As Date
pubLatest =
FormatDateTime(Me.SqlSelectCommand1.Parameters("@p ubLatest").Value,
DateFormat.ShortDate)
pubLatest = Me.SqlSelectCommand1.Parameters("@pubLatest").Valu e
pubLatest.ToShortDateString()
"Brian" <ja*****@amc.com> wrote in message
news:38**********************************@microsof t.com... Did you try pubLatest.ToShortDateString()?
Brian
"DC Gringo" wrote:
Thank you...
The only thing that did was set my time to 12:00
pubLatest = FormatDateTime(Me.SqlSelectCommand1.Parameters("@p ubLatest").Value, DateFormat.ShortDate)
______ DC G
"Lucas Tam" <RE********@rogers.com> wrote in message news:Xn***************************@140.99.99.130.. . "DC Gringo" <dc******@visiontechnology.net> wrote in
news:e2T7mLQlEHA.3968 @TK2MSFTNGP11.phx.gbl:
> How can I convert this pubLatest to a date with format "m/d/yyyy"? >
Use the function FormatDateTime
-- Lucas Tam (RE********@rogers.com) Please delete "REMOVE" from the e-mail address when replying. http://members.ebay.com/aboutme/coolspot18/
Place Option Strict On at the top of your file!!!
When you do you will see this will not compile:
Public pubLatest As Date
pubLatest =
FormatDateTime(Me.SqlSelectCommand1.Parameters("@p ubLatest").Value,
DateFormat.ShortDate)
Without Option Strict you are just playing a casting game. Casting a
sqldate to a string back to a date
If you want to format it for display, then stuff the result of either method
into a STRING, not a date variable.
Greg
"DC Gringo" <dc******@visiontechnology.net> wrote in message
news:ek**************@TK2MSFTNGP11.phx.gbl... Still no luck...neithr of these work...they both return times...
Could it be because of my declaration?
Public pubLatest As Date pubLatest = FormatDateTime(Me.SqlSelectCommand1.Parameters("@p ubLatest").Value, DateFormat.ShortDate)
pubLatest = Me.SqlSelectCommand1.Parameters("@pubLatest").Valu e pubLatest.ToShortDateString() "Brian" <ja*****@amc.com> wrote in message news:38**********************************@microsof t.com... Did you try pubLatest.ToShortDateString()?
Brian
"DC Gringo" wrote:
> Thank you... > > The only thing that did was set my time to 12:00 > > pubLatest = > FormatDateTime(Me.SqlSelectCommand1.Parameters("@p ubLatest").Value, > DateFormat.ShortDate) > > ______ > DC G > > "Lucas Tam" <RE********@rogers.com> wrote in message > news:Xn***************************@140.99.99.130.. . > > "DC Gringo" <dc******@visiontechnology.net> wrote in news:e2T7mLQlEHA.3968 > > @TK2MSFTNGP11.phx.gbl: > > > > > How can I convert this pubLatest to a date with format "m/d/yyyy"? > > > > > > > Use the function FormatDateTime > > > > -- > > Lucas Tam (RE********@rogers.com) > > Please delete "REMOVE" from the e-mail address when replying. > > http://members.ebay.com/aboutme/coolspot18/ > > >
Thanks, Greg, we're getting there...still have some compile errors, though.
pubLatest = Me.SqlSelectCommand1.Parameters("@pubLatest").Valu e
pubLatest.ToShortDateString()
Give me error: 'ToShortDateString' is not a member of 'String'.
-- and --
Public pubLatest As Date
pubLatest =
FormatDateTime(Me.SqlSelectCommand1.Parameters("@p ubLatest").Value,
DateFormat.ShortDate)
Gives me error: "Option Strict On disallows implicit conversions from
'System.Object' to 'Date'."
_____
DC G
"Greg Burns" <greg_burns@DONT_SPAM_ME_hotmail.com> wrote in message
news:uU**************@TK2MSFTNGP12.phx.gbl... Place Option Strict On at the top of your file!!!
When you do you will see this will not compile:
Public pubLatest As Date pubLatest = FormatDateTime(Me.SqlSelectCommand1.Parameters("@p ubLatest").Value, DateFormat.ShortDate)
Without Option Strict you are just playing a casting game. Casting a sqldate to a string back to a date
If you want to format it for display, then stuff the result of either
method into a STRING, not a date variable.
Greg
"DC Gringo" <dc******@visiontechnology.net> wrote in message news:ek**************@TK2MSFTNGP11.phx.gbl... Still no luck...neithr of these work...they both return times...
Could it be because of my declaration?
Public pubLatest As Date pubLatest = FormatDateTime(Me.SqlSelectCommand1.Parameters("@p ubLatest").Value, DateFormat.ShortDate)
pubLatest = Me.SqlSelectCommand1.Parameters("@pubLatest").Valu e pubLatest.ToShortDateString() "Brian" <ja*****@amc.com> wrote in message news:38**********************************@microsof t.com... Did you try pubLatest.ToShortDateString()?
Brian
"DC Gringo" wrote:
> Thank you... > > The only thing that did was set my time to 12:00 > > pubLatest = > FormatDateTime(Me.SqlSelectCommand1.Parameters("@p ubLatest").Value, > DateFormat.ShortDate) > > ______ > DC G > > "Lucas Tam" <RE********@rogers.com> wrote in message > news:Xn***************************@140.99.99.130.. . > > "DC Gringo" <dc******@visiontechnology.net> wrote in news:e2T7mLQlEHA.3968 > > @TK2MSFTNGP11.phx.gbl: > > > > > How can I convert this pubLatest to a date with format
"m/d/yyyy"? > > > > > > > Use the function FormatDateTime > > > > -- > > Lucas Tam (RE********@rogers.com) > > Please delete "REMOVE" from the e-mail address when replying. > > http://members.ebay.com/aboutme/coolspot18/ > > >
<sigh> :^)
You turn on Option Strict to discover where you are making implicit castings
at. And that is exaclty what it did. Public pubLatest As Date pubLatest = FormatDateTime(Me.SqlSelectCommand1.Parameters("@p ubLatest").Value, DateFormat.ShortDate)
Gives me error: "Option Strict On disallows implicit conversions from 'System.Object' to 'Date'."
Like I said, you are trying to shove a string (the result of either function
is a string, not a date) into a date variable. Hence "Option Strict On
disallows implicit conversions from 'System.Object' to 'Date'."
Don't do that!
If you want to display a date variable (pubLatest), then you must convert it
to a string (using either method). Both of the functions return a STRING,
not a DATE. So you cannot store it back into a DATE variable. (Well, you
can with Option strict off, but it is just casting it back to a DATE
implicitly.)
Make a new variable (say "s")
Public s As String
s = FormatDateTime(Me.SqlSelectCommand1.Parameters("@p ubLatest").Value,
DateFormat.ShortDate)
Now use "s" to display it your date variable as a formatted string.
Debug.Writeline(s)
Greg
"DC Gringo" <dc******@visiontechnology.net> wrote in message
news:ux*************@TK2MSFTNGP11.phx.gbl... Thanks, Greg, we're getting there...still have some compile errors, though.
pubLatest = Me.SqlSelectCommand1.Parameters("@pubLatest").Valu e pubLatest.ToShortDateString()
Give me error: 'ToShortDateString' is not a member of 'String'.
-- and --
Public pubLatest As Date pubLatest = FormatDateTime(Me.SqlSelectCommand1.Parameters("@p ubLatest").Value, DateFormat.ShortDate)
Gives me error: "Option Strict On disallows implicit conversions from 'System.Object' to 'Date'."
_____ DC G
"Greg Burns" <greg_burns@DONT_SPAM_ME_hotmail.com> wrote in message news:uU**************@TK2MSFTNGP12.phx.gbl... Place Option Strict On at the top of your file!!!
When you do you will see this will not compile:
Public pubLatest As Date pubLatest = FormatDateTime(Me.SqlSelectCommand1.Parameters("@p ubLatest").Value, DateFormat.ShortDate)
Without Option Strict you are just playing a casting game. Casting a sqldate to a string back to a date
If you want to format it for display, then stuff the result of either method into a STRING, not a date variable.
Greg
"DC Gringo" <dc******@visiontechnology.net> wrote in message news:ek**************@TK2MSFTNGP11.phx.gbl... > Still no luck...neithr of these work...they both return times... > > Could it be because of my declaration? > > Public pubLatest As Date > pubLatest = > FormatDateTime(Me.SqlSelectCommand1.Parameters("@p ubLatest").Value, > DateFormat.ShortDate) > > pubLatest = Me.SqlSelectCommand1.Parameters("@pubLatest").Valu e > pubLatest.ToShortDateString() > > > > "Brian" <ja*****@amc.com> wrote in message > news:38**********************************@microsof t.com... >> Did you try pubLatest.ToShortDateString()? >> >> Brian >> >> "DC Gringo" wrote: >> >> > Thank you... >> > >> > The only thing that did was set my time to 12:00 >> > >> > pubLatest = >> > FormatDateTime(Me.SqlSelectCommand1.Parameters("@p ubLatest").Value, >> > DateFormat.ShortDate) >> > >> > ______ >> > DC G >> > >> > "Lucas Tam" <RE********@rogers.com> wrote in message >> > news:Xn***************************@140.99.99.130.. . >> > > "DC Gringo" <dc******@visiontechnology.net> wrote in > news:e2T7mLQlEHA.3968 >> > > @TK2MSFTNGP11.phx.gbl: >> > > >> > > > How can I convert this pubLatest to a date with format "m/d/yyyy"? >> > > > >> > > >> > > Use the function FormatDateTime >> > > >> > > -- >> > > Lucas Tam (RE********@rogers.com) >> > > Please delete "REMOVE" from the e-mail address when replying. >> > > http://members.ebay.com/aboutme/coolspot18/ >> > >> > >> > > >
Dim pubLatest As String
pubLatest =
CDate(Me.SqlSelectCommand1.Parameters("@pubLatest" ).Value).ToShortDateString()
Mythran
"DC Gringo" <dc******@visiontechnology.net> wrote in message
news:ux*************@TK2MSFTNGP11.phx.gbl... Thanks, Greg, we're getting there...still have some compile errors, though.
pubLatest = Me.SqlSelectCommand1.Parameters("@pubLatest").Valu e pubLatest.ToShortDateString()
Give me error: 'ToShortDateString' is not a member of 'String'.
-- and --
Public pubLatest As Date pubLatest = FormatDateTime(Me.SqlSelectCommand1.Parameters("@p ubLatest").Value, DateFormat.ShortDate)
Gives me error: "Option Strict On disallows implicit conversions from 'System.Object' to 'Date'."
Greg,
You are the man...it worked!
Sorry for the density upstairs over here...
_____
Glenn
"Greg Burns" <greg_burns@DONT_SPAM_ME_hotmail.com> wrote in message
news:%2****************@TK2MSFTNGP15.phx.gbl... <sigh> :^)
You turn on Option Strict to discover where you are making implicit
castings at. And that is exaclty what it did.
Public pubLatest As Date pubLatest = FormatDateTime(Me.SqlSelectCommand1.Parameters("@p ubLatest").Value, DateFormat.ShortDate)
Gives me error: "Option Strict On disallows implicit conversions from 'System.Object' to 'Date'." Like I said, you are trying to shove a string (the result of either
function is a string, not a date) into a date variable. Hence "Option Strict On disallows implicit conversions from 'System.Object' to 'Date'."
Don't do that!
If you want to display a date variable (pubLatest), then you must convert
it to a string (using either method). Both of the functions return a STRING, not a DATE. So you cannot store it back into a DATE variable. (Well, you can with Option strict off, but it is just casting it back to a DATE implicitly.)
Make a new variable (say "s")
Public s As String s = FormatDateTime(Me.SqlSelectCommand1.Parameters("@p ubLatest").Value, DateFormat.ShortDate)
Now use "s" to display it your date variable as a formatted string.
Debug.Writeline(s)
Greg
"DC Gringo" <dc******@visiontechnology.net> wrote in message news:ux*************@TK2MSFTNGP11.phx.gbl... Thanks, Greg, we're getting there...still have some compile errors, though.
pubLatest = Me.SqlSelectCommand1.Parameters("@pubLatest").Valu e pubLatest.ToShortDateString()
Give me error: 'ToShortDateString' is not a member of 'String'.
-- and --
Public pubLatest As Date pubLatest = FormatDateTime(Me.SqlSelectCommand1.Parameters("@p ubLatest").Value, DateFormat.ShortDate)
Gives me error: "Option Strict On disallows implicit conversions from 'System.Object' to 'Date'."
_____ DC G
"Greg Burns" <greg_burns@DONT_SPAM_ME_hotmail.com> wrote in message news:uU**************@TK2MSFTNGP12.phx.gbl... Place Option Strict On at the top of your file!!!
When you do you will see this will not compile:
Public pubLatest As Date pubLatest = FormatDateTime(Me.SqlSelectCommand1.Parameters("@p ubLatest").Value, DateFormat.ShortDate)
Without Option Strict you are just playing a casting game. Casting a sqldate to a string back to a date
If you want to format it for display, then stuff the result of either method into a STRING, not a date variable.
Greg
"DC Gringo" <dc******@visiontechnology.net> wrote in message news:ek**************@TK2MSFTNGP11.phx.gbl... > Still no luck...neithr of these work...they both return times... > > Could it be because of my declaration? > > Public pubLatest As Date > pubLatest = > FormatDateTime(Me.SqlSelectCommand1.Parameters("@p ubLatest").Value, > DateFormat.ShortDate) > > pubLatest = Me.SqlSelectCommand1.Parameters("@pubLatest").Valu e > pubLatest.ToShortDateString() > > > > "Brian" <ja*****@amc.com> wrote in message > news:38**********************************@microsof t.com... >> Did you try pubLatest.ToShortDateString()? >> >> Brian >> >> "DC Gringo" wrote: >> >> > Thank you... >> > >> > The only thing that did was set my time to 12:00 >> > >> > pubLatest = >> >
FormatDateTime(Me.SqlSelectCommand1.Parameters("@p ubLatest").Value, >> > DateFormat.ShortDate) >> > >> > ______ >> > DC G >> > >> > "Lucas Tam" <RE********@rogers.com> wrote in message >> > news:Xn***************************@140.99.99.130.. . >> > > "DC Gringo" <dc******@visiontechnology.net> wrote in > news:e2T7mLQlEHA.3968 >> > > @TK2MSFTNGP11.phx.gbl: >> > > >> > > > How can I convert this pubLatest to a date with format "m/d/yyyy"? >> > > > >> > > >> > > Use the function FormatDateTime >> > > >> > > -- >> > > Lucas Tam (RE********@rogers.com) >> > > Please delete "REMOVE" from the e-mail address when replying. >> > > http://members.ebay.com/aboutme/coolspot18/ >> > >> > >> > > >
I need a cigarette. And I don't even smoke. :^)
"DC Gringo" <dc******@visiontechnology.net> wrote in message
news:uX**************@TK2MSFTNGP09.phx.gbl... Greg,
You are the man...it worked!
Sorry for the density upstairs over here...
_____ Glenn This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Hector A |
last post by:
Hi
I'm trying to convert a string that already looks like a date to a
date that I can use when I pass it from java to the database. I
receive the date in format yyyy-mm-dd and I need it to be a date
variable in 'mm/dd/yyyy' or 'm/dd/yyyy' format. My code is shown
below. Any suggestions?
code:
String sailYear =...
|
by: Richard Hollenbeck |
last post by:
I'm trying to write some code that will convert any of the most popular
standard date formats twice in to something like "dd Mmm yyyy" (i.e. 08 Jan
1908) and compare the first with the second and calculate days, months, and
years. This is not for a college course. It's for my own personal
genealogy website. I'm stumped about the code. I'm...
|
by: goochey |
last post by:
I'm trying to convert a Julian Date (Format "4365") into an actual calendar
date in Visual Basic, can anyone help me out with this.
|
by: Franck |
last post by:
Hi,
'm gettin mad about date conversion.
Here is the point.
Got and add-in for Excel which call functions from a web service (on a
remote server)
The remote server has regional settings set to "en-UK" and date to
|
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: 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: 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: 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)...
|
by: Ashraf Ansari |
last post by:
Hi,
How Can I convert MM/dd/yyyy format into dd/MM/yyyy and the date
which is converted into dd/MM/yyyy should be in DateTime format. I do
not want to store it as a string.
Please help
Thanks in advance
|
by: thomasc1020 |
last post by:
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!
|
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...
| |
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. ...
|
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...
|
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...
|
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...
|
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...
|
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...
| |
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...
| |