views:

74

answers:

3

hi

is there any way to work with date in this format: dd/MM/yyyy hh:mm (without second)

i see only this format: dd/MM/yyyy hh:mm:ss

i need that i can see in this format and to run search between date & time in this format

i work on access-2007 and C#

thank's in advance

+2  A: 

It's very simple: add ":00" to the end of what you currently have. For instance:

17/11/1985 14:56

becomes:

17/11/1985 14:56:00

Just do that and you should be all set.

machineghost
i need exactly the opposite. i have the time with seconds and i need to get rid of the seconds
Gold
+1  A: 

Yes.

The DateTime Class has a method called Format you can use to convert it into a formatted string.

http://www.csharp-examples.net/string-format-datetime/

Kissaki
+2  A: 

MS Access also has format:

Format(Now,"dd/mm/yyy hh:nn")

It can also be used in queries.

Then there are the various parts:

Day(Now)
Month(Now)
Year(Now)
Hour(Now)
Minute(Now)

See: http://support.microsoft.com/kb/210604 And: http://office.microsoft.com/en-in/access-help/format-date-and-time-values-HP001099015.aspx

Remou
...and none of those are helpful to a C# question, as you shouldn't be formatting your dates in SQL, don't you think?
David-W-Fenton
There are reasons to format a date in SQL, including when you only want part of a date.
Remou