dba123
asked on
System.DateTime.Now.Day.ToString("DD")
System.DateTime.Now.Day.To String("DD ") is not working. I want to return 03, no 3 for day 3
try lower case "dd"
ASKER
for some reason, it's putting dd in the string such as 04dd for this:
System.DateTime.Now.ToStri ng("MM") & System.DateTime.Now.Day.To String("dd ")
why is the month working but not the day in this case?
System.DateTime.Now.ToStri
why is the month working but not the day in this case?
Dim MyDate As New DateTime(now)
Dim MyString As String = MyDate.ToString("dd")
Dim MyString As String = MyDate.ToString("dd")
ASKER
why can't I do it as I did the month?
ASKER
System.DateTime.Now.ToStri ng("MM") works
ASKER
Dim MyDate As New DateTime(now)
Error: Value of type 'Date' cannot be converted to 'Long'.
I'd still prefer to do it this way, just like I did for month: System.DateTime.Now.Day.To String("dd ")
Error: Value of type 'Date' cannot be converted to 'Long'.
I'd still prefer to do it this way, just like I did for month: System.DateTime.Now.Day.To
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Dim fun As Date
fun = Now
MsgBox(Format(fun, "dd"))
fun = Now
MsgBox(Format(fun, "dd"))
What AlexFM says works for me
MessageBox.Show(Format(Now
HTH :)