helper.JodaTimeHelper.java Source code

Java tutorial

Introduction

Here is the source code for helper.JodaTimeHelper.java

Source

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package helper;

/**
 *
 * @author Kaled
 */
import org.joda.time.DateTime;
import org.joda.time.DateTimeZone;
import org.joda.time.format.DateTimeFormat;
import org.joda.time.format.DateTimeFormatter;

public class JodaTimeHelper {

    public String calculateDateTime() {
        DateTime dt = new DateTime();
        dt = dt.withZone(DateTimeZone.forID("-05:00"));
        DateTimeFormatter fmt = DateTimeFormat.forPattern("yyyy-MM-dd HH:mm:ss");
        return fmt.print(dt);
    }

}