1. #1
    Ext User
    Join Date
    Apr 2010
    Location
    Grenoble 38000, France
    Posts
    25
    Vote Rating
    0
    ghatfan99 is on a distinguished road

      0  

    Default problem with getting current date and time

    problem with getting current date and time


    hello every one,
    i have DateField for the date and TextField fro the hour:
    Code:
    DateField fin = new DateField();
    fin.setFieldLabel("Fin");
    right.add(fin, formData);
    //*****************
    TextField fTime = new TextFieldMask();
    after that i have the function for converting them:
    Code:
    private Date convertDateField(Date date, String time) {
     String fullDateTime = DateTimeFormat.getFormat("yyyy-mm-dd").format(date)+ " " + time;
     return DateTimeFormat.getFormat(pFormat).parse(fullDateTime);
        }
    and the result like that: Fri Jul 30 22:11:10 CEST 2010
    my problem is that i want to compare this result with the current date and time of the system, but i don't know how to get them (current date and time of the system) in my format :
    ("yyyy-mm-dd").format(date)+ " " + time
    if you have some ideas ???

  2. #2
    Software Architect
    Join Date
    Sep 2007
    Posts
    13,971
    Vote Rating
    132
    sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light

      0  

    Default


    Have you tried

    Code:
     DateTimeFormat.getFormat(pFormat).format(new Date());

  3. #3
    Ext User
    Join Date
    Apr 2010
    Location
    Grenoble 38000, France
    Posts
    25
    Vote Rating
    0
    ghatfan99 is on a distinguished road

      0  

    Default return type

    return type


    hello,
    thank's for your answer, i tried the code that you wrote, it works and the result is
    today date 2010-35-02 11:35:50
    but i still can't compare it with my data because the return type of your code is String and not Date, and i can't cast it to Date.
    i have
    Code:
    Date start = new Date();
     start = mission.getOuverture().getPeriodStartTime();
    Code:
    Date periodStartTime = convertDateField(debut.getValue(), dTime.getValue());
    and convertDateField is my function above
    Code:
    private Date convertDateField(Date date, String time) {
            String fullDateTime = DateTimeFormat.getFormat("yyyy-mm-dd").format(
                    date)
                    + " " + time;
            return DateTimeFormat.getFormat(pFormat).parse(fullDateTime);
        }
    and
    
    Code:
    public String pFormat = "yyyy-mm-dd HH:mm:ss";
    thank's for your help

  4. #4
    Sencha User
    Join Date
    Nov 2008
    Location
    Vienna - Austria
    Posts
    867
    Vote Rating
    1
    micgala is on a distinguished road

      0  

    Default


    ??

    For getting the current date:
    Date currentDate = new Date();

    Is that what you want? Sorry, but this is basic java :-)

  5. #5
    Ext User
    Join Date
    Apr 2010
    Location
    Grenoble 38000, France
    Posts
    25
    Vote Rating
    0
    ghatfan99 is on a distinguished road

      0  

    Default thank's

    thank's



Similar Threads

  1. How can select future day date only not a past date and current date
    By painter in forum Ext 2.x: Help & Discussion
    Replies: 2
    Last Post: 6 Apr 2009, 10:11 PM
  2. How can select current day date and future day date only
    By painter in forum Ext 2.x: Help & Discussion
    Replies: 2
    Last Post: 6 Apr 2009, 6:21 AM
  3. date time problem
    By Ajish in forum Ext 2.x: Help & Discussion
    Replies: 0
    Last Post: 12 Nov 2008, 8:22 PM
  4. Update Element to show current time & date
    By bin4ry in forum Ext 2.x: Help & Discussion
    Replies: 2
    Last Post: 15 Sep 2008, 3:34 AM

Thread Participants: 2

Turkiyenin en sevilen filmlerinin yer aldigi xnxx internet sitemiz olan ve porn sex tarzi bir site olan mobil porno izle sitemiz gercekten dillere destan bir durumda herkesin sevdigi bir site olarak tarihe gececege benziyor. Sitenin en belirgin ozelliklerinden birisi de Turkiyede gercekten kaliteli ve muntazam, duzenli porno izle siteleri olmamasidir. Bu yuzden iste. Ayrica en net goruntu kalitesine sahip adresinde yayinlanmaktadir. Mesela diğer sitelerimizden bahsedecek olursak, en iyi hd porno video arşivine sahip bir siteyiz. "The Best anal porn videos and slut anus, big asses movies set..." hd porno faketaxi