1. Download our Official Android App: Forums for Android!

Apps Date formatted text on bitmap?

Discussion in 'Android Development' started by Grendizer, Mar 16, 2010.

  1. Grendizer

    Grendizer Newbie
    Thread Starter
    Rank:
    None
    Points:
    15
    Posts:
    10
    Joined:
    Mar 14, 2010

    Mar 14, 2010
    10
    0
    15
    Hey all,

    I'm wondering how to format a date to that it will be shown as following:
    January 23 Saturday.

    I want it to be displayed on a bitmap. I've been able to draw up the bitmap, which looks like this:
    http://img692.imageshack.us/img692/9821/kalenderblad.png

    So I'd want to place January on the red part and 23 and saturday on the striped part.
    I dont think I have a problem with placing the text but i'd appreciate help with the date formatting.
     

    Advertisement

  2. jon21569

    jon21569 Newbie
    Rank:
    None
    Points:
    16
    Posts:
    23
    Joined:
    Aug 10, 2008

    Aug 10, 2008
    23
    7
    16
    import java.text.SimpleDateFormat;
    import java.util.Date;

    final Date date = new Date( System.currentTimeMillis() );
    final SimpleDateFormat formatterMonth = new SimpleDateFormat( "MMMM" );
    final SimpleDateFormat formatterDateDay = new SimpleDateFormat( "d EEEE" );
    final String monthText = formatterMonth.format(date);
    final String dateDayText = formatterDateDay.format(date);
    System.out.println( monthText );
    System.out.println( dateDayText );
     
    Grendizer likes this.

Share This Page

Loading...