Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. Web Development
  3. Changing Date/Time

Changing Date/Time

Scheduled Pinned Locked Moved Web Development
help
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    mjay2004
    wrote on last edited by
    #1

    Could anybody help me... Im trying to get the time +23 hours i've got this so far but i don't need the date just need the time <% 'Get the current date/time Dim dtNow dtNow = Now() 'Will display the date/time 23 hours from now Response.Write DateAdd("h", 23, dtNow) %> Outputs 10/03/2005 16:11:43

    D A 2 Replies Last reply
    0
    • M mjay2004

      Could anybody help me... Im trying to get the time +23 hours i've got this so far but i don't need the date just need the time <% 'Get the current date/time Dim dtNow dtNow = Now() 'Will display the date/time 23 hours from now Response.Write DateAdd("h", 23, dtNow) %> Outputs 10/03/2005 16:11:43

      D Offline
      D Offline
      DavidNohejl
      wrote on last edited by
      #2

      hi, you can format date with DateTime.ToString(string)[^] method. best regards, David 'DNH' Nohejl Never forget: "Stay kul and happy" (I.A.)

      1 Reply Last reply
      0
      • M mjay2004

        Could anybody help me... Im trying to get the time +23 hours i've got this so far but i don't need the date just need the time <% 'Get the current date/time Dim dtNow dtNow = Now() 'Will display the date/time 23 hours from now Response.Write DateAdd("h", 23, dtNow) %> Outputs 10/03/2005 16:11:43

        A Offline
        A Offline
        Abuhijleh
        wrote on last edited by
        #3

        you have to use format function or formatting with ToString function i.e Response.write DateAdd("h",23,dtNow).toString("MM-dd-yyyy") you can use whatever you want inside the toString to format your date, the toString function interpret the format like this: MM: shows the month in numbers MMM: shows the month name dd: show the day , two numbers yyyy: show the year of four digit there are other ways of formatting, see Microsoft documentation for Date.toString function

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups