?
Solved

Date format

Posted on 2015-02-17
5
Medium Priority
?
101 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 2000 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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

In .NET 2.0, Microsoft introduced the Web Site.  This was the default way to create a web Project in Visual Studio 2005.  In Visual Studio 2008, the Web Application has been restored as the default web Project in Visual Studio/.NET 3.x The Web Si…
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…
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Suggested Courses

764 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