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
  1. Home
  2. General Programming
  3. C#
  4. Date Format

Date Format

Scheduled Pinned Locked Moved C#
csharpasp-netquestion
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.
  • K Offline
    K Offline
    kibromg
    wrote on last edited by
    #1

    Hi All , I would like to to have my two variables date1 and date2 to return the following format in Asp.net. Date1=20090625124000 and date2=20090625133900 Date1 and date2 have a diffrence on one hour in between. How can i build date1 and date2 Thank you in advance.

    L M 2 Replies Last reply
    0
    • K kibromg

      Hi All , I would like to to have my two variables date1 and date2 to return the following format in Asp.net. Date1=20090625124000 and date2=20090625133900 Date1 and date2 have a diffrence on one hour in between. How can i build date1 and date2 Thank you in advance.

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      DateTime date1 = new DateTime(2009, 6, 25, 12, 40, 0); DateTime date2 = new DateTime(2009, 6, 25, 13, 39, 0); string date1Str = date1.ToString("yyyyMMddHHmmss"); string date2Str = date2.ToString("yyyyMMddHHmmss");

      1 Reply Last reply
      0
      • K kibromg

        Hi All , I would like to to have my two variables date1 and date2 to return the following format in Asp.net. Date1=20090625124000 and date2=20090625133900 Date1 and date2 have a diffrence on one hour in between. How can i build date1 and date2 Thank you in advance.

        M Offline
        M Offline
        Manas Bhardwaj
        wrote on last edited by
        #3

        string _date1 = DateTime.Now.ToString("yyyyMMddHHmmss");
        DateTime _dateNew = new DateTime(DateTime.Now.Year,
        DateTime.Now.Month,
        DateTime.Now.Day,
        DateTime.Now.Hour - 1,
        DateTime.Now.Minute - 1,
        DateTime.Now.Second);
        string _date2 = _dateNew.ToString("yyyyMMddHHmmss");

        Manas Bhardwaj Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.

        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