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. Web Development
  3. Linux, Apache, MySQL, PHP
  4. time

time

Scheduled Pinned Locked Moved Linux, Apache, MySQL, PHP
helpquestion
4 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.
  • S Offline
    S Offline
    simpocoder
    wrote on last edited by
    #1

    hey guys, Help me out this pliz, I want to capture the system time and save that in a text file as a numeric value. Do you got any idea of how this can be done?

    S B 2 Replies Last reply
    0
    • S simpocoder

      hey guys, Help me out this pliz, I want to capture the system time and save that in a text file as a numeric value. Do you got any idea of how this can be done?

      S Offline
      S Offline
      Smithers Jones
      wrote on last edited by
      #2

      Time[^] Write into a file[^]

      "I love deadlines. I like the whooshing sound they make as they fly by." (DNA)

      1 Reply Last reply
      0
      • S simpocoder

        hey guys, Help me out this pliz, I want to capture the system time and save that in a text file as a numeric value. Do you got any idea of how this can be done?

        B Offline
        B Offline
        burntblark
        wrote on last edited by
        #3

        Here:

        $file = "output.txt";//file to write to
        $f = fopen($file, 'w');//open file for writing
        $date = date("G:i:s A");//gets the server time with the format: 24:00:00 AM
        fwrite($f, $date);//write to file
        fclose($f);//close file after writing

        check the php manual for more formats for the date function

        nocturnal

        S 1 Reply Last reply
        0
        • B burntblark

          Here:

          $file = "output.txt";//file to write to
          $f = fopen($file, 'w');//open file for writing
          $date = date("G:i:s A");//gets the server time with the format: 24:00:00 AM
          fwrite($f, $date);//write to file
          fclose($f);//close file after writing

          check the php manual for more formats for the date function

          nocturnal

          S Offline
          S Offline
          simpocoder
          wrote on last edited by
          #4

          Thanks Guys, am getting somewhere. I want also to include centiseconds and i tried this

          $date = date("G:i:s:u");

          which gives something like this 16:53:10:000000 instead of digits

          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