Formatting Date ala VB6

fpineda101

Well-known member
Joined
Nov 14, 2005
Messages
122
Location
Los Angeles, CA
Programming Experience
1-3
I am trying to create an ATM system that gets the last 5 transactions and displays them. I am using Oracle as the DB. This is the code I have...

--------------------------------------------------------------------
SQL = "SELECT * FROM transaction WHERE account_number = '" & ca.SecondAccountNum & "' ORDER BY trans_date DESC"
ExecuteSQL(SQL)
For i = 0 To 4 'last five transactionsS
statementScreen += " Account: " & rs.Fields(0).Value & " "
statementScreen += " Date: " & rs.Fields(1).Value & " "
statementScreen += " Amount: " & rs.Fields(2).Value & newLine & newLine
rs.MoveNext()
Next
---------------------------------------------------------------------

The string appears like this...

Account: 22222 Date: 12/14/2005 5:30:28 PM Amount: -49.00

I would like to know how to format the date as 14-Dec-2005 or December 14, 2005. Thanks in advance for your help....
 
To format a DateTime object any way you like you call ToString on it and pass a format string as an argument. The format string for your first format would be "d-MMM-yyyy" and for the second it would be "MMMM d, yyyy". If you want to force a two digit day just use "dd" instead of "d".
 
Back
Top