2011-01-21 16 views
9

मैं GWT ट्यूटोरियल के माध्यम से और इस लाइन प्रवेश करने के बाद जा रहा हूँ, मेरी आईडीई शिकायत है कि DateTimeFormat.getMediumDateTimeFormat() करने के लिए कॉल अब मान्य नहीं है:इस बहिष्कृत विधि कॉल को कैसे बदलें?

lastUpdatedLabel.setText ("अंतिम अद्यतन: " + DateTimeFormat.getMediumDateTimeFormat () .format (नया दिनांक()));

मुझे कॉल को कैसे बदलना है?

उत्तर

9

this documentation के अनुसार, आप का उपयोग करने के getFormat(DateTimeFormat.PredefinedFormat.DATE_MEDIUM)

+1

Thx, काम किया। हालांकि मुझे 'DATE_TIME_MEDIUM' का उपयोग करना पड़ा था। – helpermethod

1

मैं अपने सुधार या हो सकता है आपकी राय, ओलिवर वीलर मिल सकता है की आवश्यकता है? शायद यह आपके लिए बहुत पुराना है ... लेकिन मैं जावा और जीडब्ल्यूटी में नया हूं ... मैं जानना चाहता हूं कि यह निम्नलिखित कोड इस बहिष्कृत विधि के लिए एक अच्छा और कुशल समाधान है या नहीं।

गूगल ट्यूटोरियल इस दे: https://developers.google.com/web-toolkit/doc/latest/tutorial/codeclient#timestamp

private void updateTable(StockPrice[] prices) { 
    for (int i = 0; i < prices.length; i++) { 
     updateTable(prices[i]); 
    } 

    // Display timestamp showing last refresh. 
    lastUpdatedLabel.setText("Last update : " + DateTimeFormat.getMediumDateTimeFormat().format(new Date())); 
    } 

मैं डाल क्यों गूगल इस ट्यूटोरियल को अद्यतन नहीं किया इस के बजाय

private void updateTable(StockPrice[] prices) { 
    for (int i = 0; i < prices.length; i++) { 
     updateTable(prices[i]); 
    } 

    // Display timestamp showing last refresh. 
    DateTimeFormat format = DateTimeFormat.getFormat(DateTimeFormat.PredefinedFormat.DATE_TIME_MEDIUM); 
    lastUpdatedLabel.setText("Last update : " + format.format(new Date())); 

    } 

पता नहीं है।

यहाँ एक पुष्टिकरण देखो: https://code.google.com/p/google-web-toolkit/issues/detail?id=8241#c3
धन्यवाद

3

@qbektrix को मैं पिछले जवाब काम करने के लिए नहीं मिल सका। यह केवल एक तारीख टिकट के साथ एक ही परिणाम देता है।

इस प्रयास करें:

lastUpdatedLabel.setText("Last update: " + 
    DateTimeFormat.getFormat(DateTimeFormat.PredefinedFormat.DATE_TIME_MEDIUM) 
       .format(new Date())); 
0

@Manu, आप

DateTimeFormat.getMediumDateTimeFormat().format(new Date()) 

साथ

DateTimeFormat.getFormat(DateTimeFormat.PredefinedFormat.DATE_TIME_MEDIUM).format(new Date()) 

यह एक प्रामाणिक GWT टीम जवाब की तरह लगता है के रूप में मैं https://code.google.com/p/google-web-toolkit/issues/detail?id=8241#c3

में यह पाया की जगह ले सकता
+0

यह एक टिप्पणी होना चाहिए। – helpermethod

+0

मेरे पास टिप्पणी करने के लिए पर्याप्त अंक (50) नहीं हैं। – qbektrix

+0

@qbektrix: मेरा जवाब देखें ... दूसरा भाग, "इसे इसके बजाय रखें" के तहत, बिल्कुल वैसे ही कहा गया है। अन्यथा, आपके अंत में लिंक के लिए धन्यवाद। – Manu

संबंधित मुद्दे