Solved

Date format

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

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

747 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

12 Experts available now in Live!

Get 1:1 Help Now