GithubHelp home page GithubHelp logo

Comments (7)

GoogleCodeExporter avatar GoogleCodeExporter commented on July 20, 2024
Also the date function syntax:
http://au.php.net/manual/en/function.date.php

I think it is really important to get a universal thing going on.

Original comment by [email protected] on 20 Mar 2008 at 12:38

from datejs.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 20, 2024
I've come up with the following as a temporary solution.

Original comment by [email protected] on 20 Mar 2008 at 1:29

Attachments:

from datejs.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 20, 2024
@balupton - ok, A while back I also played with this same concept of just 
converting
the PHP/Unix date format into a Java/.NET date format. Your persistence got me
thinking again and I've reconsidered adding the functionality into the library. 
The
conversion function probably will not make it into the core library, but I will 
add
to an optional "extras.js" module.

Original comment by geoff%[email protected] on 26 Mar 2008 at 5:42

  • Changed state: Started

from datejs.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 20, 2024
Ok awesome, problem is that the PHP date/strftime also have a lot more things 
than
Date.toString, so will you be working on adding that, or just make a conversion 
function?

And thanks a bunch!

Original comment by [email protected] on 27 Mar 2008 at 1:58

from datejs.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 20, 2024
@balupton - I added a new extras.js module that includes a the .format() 
function
which takes a Unix/PHP date format string as a parameter. 

The .format() function supports all the format specifiers. Each format 
specifier is
listed in the FormatSpecifiers wiki documentation. See
http://code.google.com/p/datejs/wiki/FormatSpecifiers

I also added a Date.normalizeFormat() function which will converts a PHP format
string to Java/.NET format string. A PHP format string can be used with 
.$format or
.format. A Java/.NET format string can be used with .toString(). The .parseExact
function will only accept a Java/.NET format string 

Example

Date.normalizeFormat("%m/%d/%y"); // "MM/dd/yy"

var f1 = "%m/%d/%y"
var f2 = Date.normalizeFormat(f1); // "MM/dd/yy"

new Date().format(f1);    // "04/13/08"
new Date().$format(f1);   // "04/13/08"
new Date().toString(f2);  // "04/13/08"

var date = Date.parseExact("04/13/08", f2); // Sun Apr 13 2008

I also added .strftime() which will format a local Unix timestamp according to 
locale
settings.

Example

Date.strftime("%m/%d/%y", new Date());       // "04/13/08"
Date.strftime("c", "2008-04-13T17:52:03Z");  // "04/13/08"

I also added .strtotime() which will parse any textual datetime description 
into a
Unix timestamp. A Unix timestamp is the number of seconds that have elapsed 
since
January 1, 1970 (midnight UTC/GMT).

Example

Date.strtotime("04/13/08");              // 1208044800
Date.strtotime("1970-01-01T00:00:00Z");  // 0   


More information is available in the CHANGELOG 
(http://www.datejs.com/changelog).

The extras.js file is available in SVN at the following location
(http://www.datejs.com/svn/extras/).

Hope this helps.

Original comment by geoff%[email protected] on 14 Apr 2008 at 5:22

  • Changed title: [FIXED] Date().toString() support for PHP's strftime
  • Changed state: Fixed

from datejs.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 20, 2024
Ok great. Although I'm a bit confused over what files I should be including?
Should I include core.js date-en-AU.js and extras.js ? And how would I go about
merging all of these into one packed file?

Original comment by [email protected] on 17 May 2008 at 12:40

from datejs.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 20, 2024
Just include the appropriate culture-specific file (date-en-AU.js) and then 
extras.js.

Example

<script type="text/javascript" src="date-en-AU.js"></script>
<script type="text/javascript" src="extras.js"></script>

The culture-specific file (date-en-US.js) already includes core.js. 

Each culture-specific file is made of the following:

1. A CultureInfo file (this is culture specific)
2. core.js
3. parser.js
4. sugarpak.js

A compressed version of extras.js is provided in the /build/ folder. Probably 
the
easiest thing to do to merge extras.js into date-en-AU.js would be to 
copy/paste the
contents of the /build/extras.js into the end of /build/date-en-AU.js.

Hope this helps.

Original comment by geoff%[email protected] on 17 May 2008 at 8:47

from datejs.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.