Solved

Date format

Posted on 2015-02-17
5
92 Views
Last Modified: 2015-02-17
Is there a way to set date as the beginning of the month like 02/01/2015. Right now it 2/01/2015.


ASPxDateEdit_start_date.Date = DateSerial(Today.Year, Today.Month, 1) 

Open in new window

0
Comment
Question by:VBdotnet2005
  • 3
  • 2
5 Comments
 
LVL 63

Expert Comment

by:Fernando Soto
ID: 40615584
Hi VBdotnet2005;

Is this what you are looking for?

Dim firstOfMonth = DateTime.Today.AddDays(-(DateTime.Today.Day - 1))

Open in new window

0
 

Author Comment

by:VBdotnet2005
ID: 40615594
It returns 2/1/2015. Can we do it in 02/01/2015?
0
 
LVL 63

Accepted Solution

by:
Fernando Soto earned 500 total points
ID: 40615601
Hi VBdotnet2005;

A DateTime object is represented in memory in just one way just like an integer or any other data type. This DateTime can be displayed or written to a file in string format and in that format you can display it in that way as follows.

Dim dt = DateTime.Today.AddDays(-(DateTime.Today.Day - 1)).ToString("MM/dd/yyyy")

Open in new window

0
 

Author Comment

by:VBdotnet2005
ID: 40615676
Thank you again Fernando
0
 
LVL 63

Expert Comment

by:Fernando Soto
ID: 40615679
Not a problem VBdotnet2005, glad to help.
0

Featured Post

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
ASP.net Show "please wait " message as page loads 2 42
.NET 2008 VB and C# 6 28
transaction in asp.net, sql server 6 33
get combo value in class 5 9
A quick way to get a menu to work on our website, is using the Menu control and assign it to a web.sitemap using SiteMapDataSource. Example of web.sitemap file: (CODE) Sample code to add to the page menu: (CODE) Running the application, we wi…
User art_snob (http://www.experts-exchange.com/M_6114203.html) encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

803 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question