Reputation: 445
I dont know how to get the current date in visual basic 2008. Here is a sample code
regDate = Format(Date.Now(), "ddMMMyyyy")
The output is like 7/02/1900
Need help
Upvotes: 5
Views: 208884
Reputation: 31
Dim regDate As Date = Date.Now.date
This should fix your problem, though it's 2 years old!
Upvotes: -2
Reputation: 432
If you need exact '/' delimiters, for example: 09/20/2013 rather than 09.20.2013, use escape sequence '/':
Dim regDate As Date = Date.Now()
Dim strDate As String = regDate.ToString("MM\/dd\/yyyy")
Upvotes: 1
Reputation: 271
User can use this
Dim todaysdate As String = String.Format("{0:dd/MM/yyyy}", DateTime.Now)
this will format the date as required whereas user can change the string type dd/MM/yyyy or MM/dd/yyyy or yyyy/MM/dd or even can have this format to get the time from date
yyyy/MM/dd HH:mm:ss
Upvotes: 27
Reputation: 3312
Try this:
Dim regDate as Date = Date.Now()
Dim strDate as String = regDate.ToString("ddMMMyyyy")
strDate will look like so: 07Feb2012
Upvotes: 9