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. Mobile Development
  3. Mobile
  4. how to change date & time in C# for PPC

how to change date & time in C# for PPC

Scheduled Pinned Locked Moved Mobile
questioncsharphelptutorial
2 Posts 2 Posters 3 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.
  • E Offline
    E Offline
    E_Gold
    wrote on last edited by
    #1

    hi how can i change time & date in PPC using C# 2005 ? thank for any help

    M 1 Reply Last reply
    0
    • E E_Gold

      hi how can i change time & date in PPC using C# 2005 ? thank for any help

      M Offline
      M Offline
      mac24nzmac24nz
      wrote on last edited by
      #2

      I've only been able to manage that by using calls to the windows APIs which only work on some PDAs (on my development Dell X51V it works, on some Symbols it doesn't. I'm not sure why - no exception or anything, just the time doesn't change) Hope that helps, but maybe someone knows a C# way of doing that. Martin [DllImport("coredll.dll")] public extern static void GetSystemTime(ref SYSTEMTIME lpSystemTime); [DllImport("coredll.dll")] public extern static uint SetSystemTime(ref SYSTEMTIME lpSystemTime); public struct SYSTEMTIME { public ushort wYear; public ushort wMonth; public ushort wDayOfWeek; public ushort wDay; public ushort wHour; public ushort wMinute; public ushort wSecond; public ushort wMilliseconds; } public static void setSystemDate(DateTime newTime) { // Set the clock to this time SYSTEMTIME st = new SYSTEMTIME(); st.wMilliseconds = (ushort)newTime.ToUniversalTime().Millisecond; st.wSecond = (ushort)newTime.ToUniversalTime().Second; st.wMinute = (ushort)newTime.ToUniversalTime().Minute; st.wHour = (ushort)newTime.ToUniversalTime().Hour; st.wDay = (ushort)newTime.ToUniversalTime().Day; st.wMonth = (ushort)newTime.ToUniversalTime().Month; st.wYear = (ushort)newTime.ToUniversalTime().Year; //GetSystemTime(ref st); //st.wHour = (ushort)(st.wHour + 1 % 24); SetSystemTime(ref st); }

      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