Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 559
  • Last Modified:

current time + 10 min in yyyy-mm-dd hh:mm format using asp.net/vb.net

Hi

i want to get current system time+10 minutes   in yyyy-MM-dd HH:mm using asp.net/vb.net
i am using .net 3.5 .

Thanks,
0
ram27
Asked:
ram27
4 Solutions
 
DhaestCommented:
You can try this:

Dim currentTime As DateTime = DateTime.Now 
currentTime.AddMinutes(10) 
Dim printDate As String = currentTime.ToString("yyyy-MM-dd HH:mm") 

Open in new window

0
 
Kevin CrossChief Technology OfficerCommented:
You can use the AddMinutes method of DateTime object and then use ToString with format you want.
Dim now As DateTime = DateTime.Now
        MsgBox(now.AddMinutes(10).ToString("yyyy-MM-dd HH:mm"))

Open in new window

0
 
Kevin CrossChief Technology OfficerCommented:
Ah, too slow. :)
0
Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
ram27Author Commented:
hi Dhaest,

i want time in 24hrs format ex: 2009-07-08 20:10 etc.. can you please help
0
 
DhaestCommented:
It is in 24hrs format ...
0
 
Kevin CrossChief Technology OfficerCommented:
Agreed!
"yyyy-MM-dd HH:mm" == 24 hour clock w/ leading zero (single H removes leading zero)
"yyyy-MM-dd hh:mm" == 12 hour clock w/ leading zero
0
 
Mike TomlinsonMiddle School Assistant TeacherCommented:
*In Dhaest's example, you need to change:

    currentTime.AddMinutes(10)

To:

    currentTime = currentTime.AddMinutes(10)
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now