Results 1 to 9 of 9

Thread: Javascript : Client date format?

  1. #1

    Thread Starter
    The Devil crptcblade's Avatar
    Join Date
    Aug 2000
    Location
    Quetzalshacatenango
    Posts
    9,091

    Javascript : Client date format?

    Is there a way to get the date format of the client through javascript?
    Laugh, and the world laughs with you. Cry, and you just water down your vodka.


    Take credit, not responsibility

  2. #2
    Fanatic Member Psyrus's Avatar
    Join Date
    Jul 2000
    Location
    NJ
    Posts
    602

    Re: Javascript : Client date format?

    I don't know of any way to return the format used. I believe that Javascript only has methods to get and set date values, not to directly return the format. I suppose it wouldn't be too hard to write a function that does this yourself parsing the string returned from the toLocaleString() method and comparing it against the different formats that you are after.
    Chris

    VB 6.0 Calendar App Video Gamers Group
    Don't forget to rate people if they helped you.

  3. #3
    Fanatic Member Psyrus's Avatar
    Join Date
    Jul 2000
    Location
    NJ
    Posts
    602

    Re: Javascript : Client date format?

    On second thought, it might be kind of difficult...

    Chris

    VB 6.0 Calendar App Video Gamers Group
    Don't forget to rate people if they helped you.

  4. #4
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: Javascript : Client date format?

    toLocaleDateString();

  5. #5
    Fanatic Member Psyrus's Avatar
    Join Date
    Jul 2000
    Location
    NJ
    Posts
    602

    Re: Javascript : Client date format?

    I thought that he was after the "mm/dd/yyyy" type kind of format returned as a string? Anyway, thanks for posting that version. It's a lot easier to use instead of parsing out the time, the way I originally was.

    Chris

    VB 6.0 Calendar App Video Gamers Group
    Don't forget to rate people if they helped you.

  6. #6

    Thread Starter
    The Devil crptcblade's Avatar
    Join Date
    Aug 2000
    Location
    Quetzalshacatenango
    Posts
    9,091

    Re: Javascript : Client date format?

    Quote Originally Posted by Psyrus
    I thought that he was after the "mm/dd/yyyy" type kind of format returned as a string?
    Exactly. What I'm trying to accomplish in the long run is sort of a mask edit box for date entry, so I need to be able to figure out the format in order to come up with the mask.

    Unless someone can think of a better way.

    Laugh, and the world laughs with you. Cry, and you just water down your vodka.


    Take credit, not responsibility

  7. #7
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: Javascript : Client date format?

    Forget masking. Use 2 textboxes and a combobox like normal people.

  8. #8

    Thread Starter
    The Devil crptcblade's Avatar
    Join Date
    Aug 2000
    Location
    Quetzalshacatenango
    Posts
    9,091

    Re: Javascript : Client date format?

    Quote Originally Posted by mendhak
    like normal people.
    Have we met?

    I'll probably settle for dropdown box approach, just trying to appease my audience.
    Laugh, and the world laughs with you. Cry, and you just water down your vodka.


    Take credit, not responsibility

  9. #9
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: Javascript : Client date format?

    Excellent choice. I'll have PeeWee Herman bring in the check.

Posting Permissions

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



Click Here to Expand Forum to Full Width