Click here to Skip to main content
15,906,463 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralExcel Pin
Britnt712-Jan-05 9:23
Britnt712-Jan-05 9:23 
GeneralRe: Excel Pin
Dave Kreskowiak12-Jan-05 12:02
mveDave Kreskowiak12-Jan-05 12:02 
GeneralRe: Excel Pin
Ritesh123413-Jan-05 3:42
Ritesh123413-Jan-05 3:42 
GeneralRe: Excel Pin
Britnt713-Jan-05 4:20
Britnt713-Jan-05 4:20 
GeneralRe: Excel Pin
Ritesh123413-Jan-05 3:47
Ritesh123413-Jan-05 3:47 
GeneralPopulating grid with months of a year Pin
Paps212-Jan-05 7:45
Paps212-Jan-05 7:45 
GeneralFormat date function and variables Pin
Drexel GG12-Jan-05 6:19
sussDrexel GG12-Jan-05 6:19 
GeneralRe: Format date function and variables Pin
Dave Kreskowiak12-Jan-05 8:43
mveDave Kreskowiak12-Jan-05 8:43 
I'm assuming VB.NET here... You didn't say which version of VB you were using.

Drexel GG wrote:
FormatDate = Format(#12/31/2003#, "dd-MMM-yyyy")

The #12/31/2003# is a value of type Date. This is a Visual Basic primitive type that maps onto the .NET Framework runtime type called DateTime, which is really a structure. The Format function can easily convert this value into the format that you specify because it can call the DateTime structure's .ToString() method do the conversion.


Drexel GG wrote:
FormatDate = Format(Session("1"), "dd-MMM-yyyy")

I'm assuming Session("1") returns a String type. You haven't provided enough code or information to make this determination. But, if Session("1") is a String type, then the Format function has no way of determining that this is a date and has no idea how to convert it to one.

You'll have to try and Parse the Session("1") String and create a DateTime object out of it in order to pass this to the Format function.
Dim myDate As DateTime
Try
    myDate = DateTime.Parse(Session("1"))
    FormatDate = Format(myDate, "dd-MMM-yyyy")
Catch ex As Exception
    ' It's possible that the date isn't in the correct format.
    ' If that's the case, we'll end up here.
End Try



RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome

GeneralRe: Format date function and variables Pin
Anonymous12-Jan-05 10:38
Anonymous12-Jan-05 10:38 
Generaldatasets (vb.net 2003) Pin
std770212-Jan-05 4:10
std770212-Jan-05 4:10 
GeneralSendMessage() Function Help Pin
Damian Castroviejo12-Jan-05 2:38
Damian Castroviejo12-Jan-05 2:38 
GeneralRe: SendMessage() Function Help Pin
Dave Kreskowiak12-Jan-05 4:20
mveDave Kreskowiak12-Jan-05 4:20 
GeneralRe: SendMessage() Function Help Pin
Damian Castroviejo13-Jan-05 2:11
Damian Castroviejo13-Jan-05 2:11 
GeneralRe: SendMessage() Function Help Pin
Dave Kreskowiak13-Jan-05 3:37
mveDave Kreskowiak13-Jan-05 3:37 
GeneralRe: SendMessage() Function Help Pin
Damian Castroviejo13-Jan-05 6:02
Damian Castroviejo13-Jan-05 6:02 
GeneralPage subtotal in MS Access 2003 Report Pin
steff kamush12-Jan-05 2:35
steff kamush12-Jan-05 2:35 
GeneralRe: Page subtotal in MS Access 2003 Report Pin
Dave Kreskowiak12-Jan-05 3:59
mveDave Kreskowiak12-Jan-05 3:59 
GeneralUpdateLayeredWindow - My great pain :) Pin
Axonn Echysttas11-Jan-05 21:46
Axonn Echysttas11-Jan-05 21:46 
GeneralRe: UpdateLayeredWindow - My great pain :) Pin
Dave Kreskowiak12-Jan-05 4:56
mveDave Kreskowiak12-Jan-05 4:56 
GeneralRe: UpdateLayeredWindow - My great pain :) Pin
Axonn Echysttas12-Jan-05 21:39
Axonn Echysttas12-Jan-05 21:39 
GeneralRe: UpdateLayeredWindow - My great pain :) Pin
Dave Kreskowiak13-Jan-05 2:10
mveDave Kreskowiak13-Jan-05 2:10 
GeneralRe: UpdateLayeredWindow - My great pain :) Pin
Axonn Echysttas13-Jan-05 9:33
Axonn Echysttas13-Jan-05 9:33 
Generalbuttons location while Drag and Drop Pin
Greeky11-Jan-05 21:24
Greeky11-Jan-05 21:24 
GeneralVB and C++ dll Pin
Tomaz Rotovnik11-Jan-05 20:23
Tomaz Rotovnik11-Jan-05 20:23 
GeneralRe: VB and C++ dll Pin
[DK]KiloDunse11-Jan-05 23:50
[DK]KiloDunse11-Jan-05 23:50 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.