Solved

Date format

Posted on 2015-02-17
5
96 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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

In an ASP.NET application, I faced some technical problems. In this article, I list them out and show the solutions that I found.  I hope it will be useful. Problem: After closing a pop-up window, the parent page should be refreshed automaticall…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

830 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