Results 1 to 8 of 8

Thread: date and time

  1. #1
    Join Date
    May 2002
    Location
    Klate
    Posts
    91
    Rep Power
    213

    date and time

    i need a help
    first i format my date using date() function like this:

    PHP Code:
    $mydate=date("H:i:s j/n/Y",time()); 
    that will produce something like this 20:32:41 4/5/2004

    but how can I convert $mydate's value back to integer value
    is there any func to do this?

  2. #2
    Join Date
    Feb 2003
    Location
    Kluang, Johor
    Posts
    2,367
    Rep Power
    249
    how about store the time() value first then only do the format? Then you can get back the time value from the variable. Example:
    PHP Code:
    $currentTime time();
    $mydate=date("H:i:s j/n/Y",$currentTime); 
    Or, you can use mktime()

  3. #3
    Join Date
    Feb 2004
    Location
    Shah Alam
    Posts
    175
    Rep Power
    193
    You could try strtotime to convert the string time back to integer, but i am not sure your time format is the one that it recognizes.

  4. #4
    Join Date
    May 2002
    Location
    Klate
    Posts
    91
    Rep Power
    213
    yup, i'd tried strtotime() func but it didn't work. maybe it's better for me to store time in integer format like LcF said. easy to format

  5. #5
    Join Date
    Nov 2001
    Location
    Johor
    Posts
    772
    Rep Power
    233
    hehe put it to ur function

    function timetoint() {
    ...
    }

    I hate when:

    vBulletin Message:
    Sorry! The administrator has specified that users can only post one message every 60 seconds

  6. #6
    Join Date
    Oct 2004
    Location
    Deep Inside
    Posts
    13
    Rep Power
    0
    easier

    PHP Code:
    <?php

      
    echo( date("l, F dS Y.") );

    ?>

  7. #7
    Join Date
    Jan 2003
    Location
    PJ
    Posts
    51
    Rep Power
    204
    PHP Code:
    $hehe=strtotime(date("Y-n-d H:i:s",time()));
    echo 
    $hehe
    Macam ni kalu nak convert textual datetime to UNIXTIMESTAMP, ni dah jadi interger la..ko buleh la tolak ke tambah ke lepas tu convert jadi textual datetime balik.

    PHP Code:
    $huhu=date('Y-n-d H:i:s'$hehe);
    echo 
    $huhu
    p/s: date kena kat depan, time kat belakang...kena ikut format camtu......kalo ko ikut suka hati nak letak mana...function ni tak jalan.
    Try and Support Malaysia Product.
    http://foto.home.net.my

  8. #8
    Join Date
    Feb 2003
    Location
    Kluang, Johor
    Posts
    2,367
    Rep Power
    249
    Note:
    Remember to use the accepted format in "Date input formats" when using strtotime().

    Link: http://www.gnu.org/software/tar/manu...ter/tar_7.html

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. time & date on tittle bar (javascript)
    By fifin04 in forum Website Design
    Replies: 0
    Last Post: 11-11-2005, 05:47 PM
  2. date&time in mysql
    By white_neck in forum Website Programming
    Replies: 4
    Last Post: 19-09-2005, 05:49 PM
  3. between 2 date
    By meiji in forum Website Programming
    Replies: 2
    Last Post: 29-04-2005, 09:44 AM
  4. Date question
    By ngaisteve1 in forum Website Programming
    Replies: 0
    Last Post: 11-04-2004, 09:07 PM
  5. Date & Time dlm website
    By abOOn in forum Website Design
    Replies: 9
    Last Post: 29-08-2003, 06:25 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

Search Engine Optimization by vBSEO 3.5.0 RC1 PL1

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112