Solved

Date format

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

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 62

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 62

Expert Comment

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

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Today is the age of broadband.  More and more people are going this route determined to experience the web and it’s multitude of services as quickly and painlessly as possible. Coupled with the move to broadband, people are experiencing the web via …
The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
Hi friends,  in this video  I'll show you how new windows 10 user can learn the using of windows 10. Thank you.
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

910 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now