Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 556
  • 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
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.

 
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

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

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