Determine Local Representation Of A Specific GMT Datetime?
Nov 12, 2010
I want to get the date value for
Nov 1, 2010 00:00:00 GMT
expressed in my local time.What is the best way? Currently, I am doing this:
Dim NovGmt As Date = New Date(2010, 11, 1, 0, 0, 0)
Dim Nov1AsLocal As Date = GetGmtExpressedAsLocal(NovGmt)
Private Function GetGmtExpressedAsLocal(ByVal gmtDate As Date) As Date
[code].....
tell me difference between the Date and DateTime datatypes? Is DateTime newer than Date or is it just a synonym for Date? If the latter, why have both?
View 1 Replies
ADVERTISEMENT
Jan 11, 2010
In VB6 if I wanted to see if a datetime field wasn't set, I could do something like if myDate = 0 then. I tried that with VB.NET and it can't compare to an integer. How do we do this now? I found the Ticks property, so if myDate.Ticks = 0 does seem to work, but I'm not sure if that's the "right" way to do it. None of the other things I've tried have been successful.
Dim dt As New DateTime
If dt.Ticks = 0 Then MsgBox("dt.Ticks = 0") 'this fires
If IsDBNull(dt) Then MsgBox("IsDBNull(dt)") 'doesn't fire, so no good
If Not IsDate(dt) Then MsgBox("Not IsDate(dt)") 'doesn't fire, so no good
'If dt Is Nothing Then MsgBox("dt is nothing") 'not legal syntax
View 9 Replies
Oct 22, 2010
The following works fine in c# (assuming value is an object):
if (value is DateTime)
What is the equivalent check for VB.NET?
View 3 Replies
Sep 3, 2010
Is there a way in VB.Net to determine if the timezone the current system has daylight savings time in effect? Of course I can get the offset from GMT using the "z"/"zz" formatting option, but that doesn't tell me if DST is in effect for the current timezone or if the current timezone is in standard time...or if DST/Standard time aren't even an issue in the timezone for the system.
View 4 Replies
May 9, 2011
I am looking for a way to determine whether a file spec that I provide is local or remote. I am using VB2008. I have a VB6 app that does this by using the PathIsNetworkPath API call, but I am hoping that I can use the .NET framework instead with VB2008. Google gives lots of results on how to determine if a network path is available, but not specifically what I want.
View 4 Replies
Sep 17, 2011
how to manipulate the dates to determine which date will be 30 days more then the datetime control I have on my form. i need to take the chosen date from the DateTime control, and determine what date it will be in 30 days. Eventually I will use this process to search through the database to print monthly reports.
View 4 Replies
Sep 1, 2011
I am doing work on a new logging database that I have decided to use UTC datetime to store all datetime values since our company spans timezones and multiple sources and timezones are logging events.However the problem that I cannot get my head around is formatting the datetimes in my datagridview for my user application.Our applications use mostly LINQ to SQL to manipulate our data from generic SQL CRUD calls, so I am hoping I can mask/format the DGV to get the conversion or some LINQ function rather than having to write special SQL stored procedures to do it every time I need to display the data.. (I have found multiple sources that explain how to do that)
View 1 Replies
Feb 4, 2011
I have an application that produces a form whose objects are scaled to the width and height of the primary monitor whose parameters are obtained from:
Dim ScreenWidth As Integer = Screen.PrimaryScreen.Bounds.Width
Dim ScreenHeight As Integer = Screen.PrimaryScreen.Bounds.Height
So far, the program works fine. A possible problem arises when multiple monitors are being used that do not share the same resolution. For example, if the 2nd monitor has a low resolution, then the form is cut-off.
I'd like to:
1.) determine that more than half the form has been moved to another monitor
2.) determine the resolution on the second monitor.
I suspect that the following command will give me all the dimensions that I need:
Dim ScreenWidthUsed As Array = Screen.AllScreens
In which case I just need to determine the screen that is hosting more than 1/2 the form.
View 3 Replies
Apr 6, 2009
I am using a webbrowser control, which is used for both internet and folder exploring. How can I determine when viewing files on the local directory, which file is selected?
I ran across something in my searches saying there was a property under the webbrowser.document called SelectedItem. But this must not be in 2008.
View 3 Replies
Jul 23, 2010
i need to check for a specific DateTime value in my table from my code (VB.NET) and i don't know how to format the DateTime as a string. i've read that SQL Server will recognize my string if it's in either date, time, or date and time format. i mean:
'May 15, 2004'
'5/15/2004'
'20040515'
[code]......
View 4 Replies
May 10, 2010
I need to have my DateTime format match this type: 2010-04-10T10:00:03. When the user clicks the 'Update Modification Time' button, I need the exact Date and Time, in that format, to be saved in an .INI file.
View 2 Replies
May 8, 2011
i have a problem converting a datetime of a specific format , you may notice a colon in between the date and time.
Dim time As DateTime
Dim str As String = "26/02/2009:18:37:58"
time = DateTime.Parse(str, "dd/MM/yyyy:HH:mm:ss")
Console.WriteLine(time)
View 2 Replies
Mar 9, 2009
I would like to place an if condition within the sub that will tell it to run when the xml node STORE with attribute TEST="test.doc" does not exist.
Sub InsertNode(ByVal doc As XmlDocument)
Dim City As XmlNode = doc.DocumentElement
Dim Location As XmlElement = doc.CreateElement("store")
Location.SetAttribute("test", "test.doc")
[code]....
View 3 Replies
Feb 23, 2010
How can I programmatically determine if .net 2 or any other .net framework is on a computer?
View 4 Replies
Feb 10, 2010
I'm trying to determine if a interface is decorated with a specific attribute. For example, I have the following interface:
<MyCustomAttribute()> _
Public Interface IMyInterface
Function Function1
[code]....
How do I determine if IMyInterface is decorated with the MyCustomAttribute attribute?
View 3 Replies
Nov 14, 2010
I've created the following basic function to determine whether specific control type is currently loaded:
Private Function IsPreviewerTypeLoaded(Of T)() As Boolean
For Each previewer In LoadedPreviewers
If previewer.GetType().Equals(T) Then
[Code]....
I need to compare each control against the generic type supplied. Equals(T) fails to do the job, producing a compiler error. How to make it correctly?
UPDATE: is the following correct?
previewer.GetType().Equals(GetType(T))
View 2 Replies
Mar 30, 2011
How do I read/get text/line between specific text. For example:
my html-file contains
<title>This is my Title</title>
I have found a code, which I needed to convert from C#, but it doesn't work:
Private Shared Function GetTitle(html As String) As String
Dim r As New Regex("<title.*?>")
Dim Title_start As Integer = 0
[Code].....
I have already loaded the html-text into a rtb, so perhaps is easier to extract it from there.
View 3 Replies
Nov 28, 2011
Say a machine has two seperate IP's. I am running a little test program that connects to an outside piece of hardware that has it's own IP. I receive data from that hardware. I want the same little program assigned to the two seperate IPs on my local machine to get the same data from the hardware. How can this be done?I am receiving data just fine but I am not seeing how to tie the program to a specific IP on the local machine. As soon as I run another instance of my program, not data is received on the second instance.For example: I have a program running on a machine. I want two instances of that program, each on it's own ip
Instance 1: 192.168.1.240
Instance 2: 192.168.1.241
I want both instances to listen for data coming from 192.168.1.50
This is a generic example of what needs to happen. I need to know how to define the local IP's the UDPClient is running on.
View 4 Replies
Dec 15, 2011
I need to determine which students have a specific major based upon the button that is clicked , then code will pull all the CS student's name and put them in the results list box. The text box above the results list box should contain the specified major and the text box below the results list box should contain a message indicating the total number of students with specific major.
View 4 Replies
Aug 24, 2011
I used .NET Framework 1.1 in C/S project before. Now I have updated the project to use .NET Framework 3.5 without modifying source code, but I have found that : the Remoted DateTime values can not be converted to the equivalent local time of a remote computer that is in a different time zone. In .NET Framework 1.1, the DateTime values can be converted automatically.
[Code]...
View 2 Replies
Dec 10, 2008
Does anyone know if there is a way to determine if a drive is local or a network drive?
View 1 Replies
Nov 6, 2009
is there an object representation of System that i can Extend upon such that the extended method becomes global.
<Runtime.CompilerServices.Extension()> Public sub globalprocedure(ByVal asystem As ?)
View 3 Replies
Jun 27, 2012
[URL]notice that the tag topic count for C# is in excess of 8900 while the vb.net tag topic count is sitting at 1019. Does this mean that there is a shift towards c# as a .net language of choice. the only reason I decided to build some applications for work using c# was that I like curly braces - after all vb has the same language support as c#, doesn't it so there should be no advantage to choosing one over the other; other than curly braces;)
View 7 Replies
Apr 16, 2010
Is it guaranteed that the numeric values for an Enum with only uninitialized values start at zero and increment by one in the order defined?
View 2 Replies
Aug 15, 2009
I am totally new to the graphical representation of the data. I want to make a progress report of students, based on marks achieved each year.For example, in year 2005 marks were 750. in 2006 780 in 2007 800
View 15 Replies
Feb 15, 2010
I am trying to convert a string to a single. Ive tried csng() directcast() and single.parse. The first two methods crash. Single.parse says input string was in incorrect format. The number is 777.7932 so should convert fine. Ive tried it this way:
'x = single.parse(pts(0), globalization.NumberStyles.AllowDecimalPoint)
how can i convert a string representation of a single data type that is read from a text file into its single data type. I checked control panel and globalization settings are set to english.
View 6 Replies
Aug 2, 2011
I have a file from the client which is a text file. I have to decode the file to a graphical representation. Is there any way I can do it?
View 16 Replies
Dec 30, 2009
I want program to do Graphical Representation of array Sorting in vb.net with bars/shapes.
View 1 Replies
Jun 24, 2011
Is there a fast way in VB.NET to take a 32-bit int and cast to a 32-bit float while preserving the underlying bit structure? BitConverter will do this, but I'd like to cast it directly without involving byte arrays.
View 1 Replies
Aug 6, 2009
While testing some code i found something strange how vb.net (2005) is handling integer representation of true and false (or yes and no). Or at least i dont understand the reason for this.Im used to C or Java where 0 is false and everything else is true. To get to the point, here is the code: [code] And the out put is:X: 1 Y: 2x is truey is truex and y is false.If x and y or both individually true, why does it return false when you evaluate x And y.However, change the values of x and y to 4 and 5 you get this:X: 4 Y: 5x is truey is truex and y is trueJust another example, which seems to work how it should to me:X: 4 Y: 0x is truey is falsex and y is false.
View 7 Replies