PersianDate


Source link: https://github.com/samanzamani/PersianDate

Persian Date(Jalali)

About

This is simple android calender converter for Convert Jalali date to Gregorian date.

Gradle

dependencies {

  compile 'com.github.samanzamani.persiandate:PersianDate:0.0.2' 
}

Let's convert some date :)

Step 1

PersianDate pdate = new PersianDate();

step2

PersianDateFormat pdformater = new PersianDateFormat();
 pdformater.format(pdate);

More example

PersianDate

  • PersianDate class methods
method describtion
PersianDate(Long timestamp) make time with timestamp
PersianDate(DATE date) Constractor for make PersianDate object from Date object
setShYear(int year) Set Jalali year
setShMonth(int month) Set Jalali month
setShDay(int day) Set Jalali day
setGrgYear(int day) Set Gregorian year
setGrgMonth(int day) Set Gregorian month
setGrgDay(int day) Set Gregorian day
setHour(int hour) Set hour of day
setMinute(int minute) Set minute of day
setSecond(int second) Set second of day
getShYear() (int) return Jalali year
getShMonth() (int) return Jalali month
getShDay() (int) return Jalali day
getGrgYear() (int) return Gregorian year
getGrgMonth() (int) return Gregorian month
getGrgDay() (int) return Gregorian day
getHour() (int) return hour of day
getMinute() (int) return minute of day
getSecond() (int) return second of day
getTime() (Long) return timestamp
initGrgDate() init date from Gregorian
initJalaliDate() init date from Jalali
isLeap() Check Jalali year is leap (TRUE-FALSE)
grgIsLeap() Check Gregorian year is leap (TRUE-FALSE)
toJalali(int year, int month, int day) Convert Gregorian to Jalali (return int[3])
toGregorian(int year, int month, int day) Convert Jalali to Gregorian (return int[3])
dayOfWeek() 0-6 (0=sat)
getDayInYear() 1-366
dayName() ????-????
monthName() ???????-?????
getMonthDays() return month lenght
addDate() add some date to object
after(PersianDate dateInput) Compare 2 date (true=if input date after this)
before(PersianDate dateInput) Compare 2 date (true=if input date before this)
equals(PersianDate dateInput) Compare 2 date (true=if input date equals this)
untilToday() Cal year,month,day until now
getDayuntilToday() Cal day until now
toDate convert to Date object

PersianDateFormat

  • PersianDate class methods for display and parse date
method describtion
format() (String) Display date
parse(String date,String pattern) (PersianDate) Convert string Jalali date (1396-05-05 & 'YYYY-MM-dd') to Persiandate
parseGrg(String date,String pattern) (PersianDate) Convert string Gregorian date (1396-05-05 & 'YYYY-MM-dd') to Persiandate
format() (String) Display date
  • Item for parse date
String key Role
YYYY Year (1396-2012-...)
MM Month number (12-01-02-...)
dd Day number (21-01-02-...)
HH Hour (21-01-02-...)
mm Minute (21-01-02-...)
ss Second (21-01-02-...)
  • Pattern item for format date
Pattern key Role
l Day name in week (???? ? ....)
j Day number in month(1-10-20...)
F Month name (???????)
Y Year (1396...)
H Hour in day
i Minutes in hour
s Second in minute
d day in month (01-02-21...)
g Hour in day 1-12
n Month of year 1-12
m Month of year 01-12
t number day of month
w day in week 0-6
y year with 2 digits
z Number of days (full) past the year
L Is leap year (0-1)

Example

PersianDate pdate = new PersianDate();
 PersianDateFormat pdformater1 = new PersianDateFormat('Y/m/d');
 pdformater1.format(pdate);
//1396/05/20  PersianDateFormat pdformater2 = new PersianDateFormat('y F j');
 pdformater2.format(pdate);
//?? ??? ??

Resources

Easy font usage in your Android XML layouts

  • Based on Data Binding
  • Written in Kotlin
  • Automatic initialization
  • Automatic font caching
  • Homogeneous android:font usage
  • Tiny size: 14 KB
  • Minimum Android SDK: 7
  • Available through jCenter

Plugin for AndroidAnnotations allowing to use it together with PermissionsDispatcher. All you have to do is to include it in your dependencies.

A framework for building Mobile cross-platform UI.

A version info widget for Android with material style.

FogView is a android library that can show fog on any layout and the fog removes when user rubs it.

A custom Android TextView to display amounts of money in different formats.

Topics


2D Engines   3D Engines   9-Patch   Action Bars   Activities   ADB   Advertisements   Analytics   Animations   ANR   AOP   API   APK   APT   Architecture   Audio   Autocomplete   Background Processing   Backward Compatibility   Badges   Bar Codes   Benchmarking   Bitmaps   Bluetooth   Blur Effects   Bread Crumbs   BRMS   Browser Extensions   Build Systems   Bundles   Buttons   Caching   Camera   Canvas   Cards   Carousels   Changelog   Checkboxes   Cloud Storages   Color Analysis   Color Pickers   Colors   Comet/Push   Compass Sensors   Conferences   Content Providers   Continuous Integration   Crash Reports   Credit Cards   Credits   CSV   Curl/Flip   Data Binding   Data Generators   Data Structures   Database   Database Browsers   Date &   Debugging   Decompilers   Deep Links   Dependency Injections   Design   Design Patterns   Dex   Dialogs   Distributed Computing   Distribution Platforms   Download Managers   Drawables   Emoji   Emulators   EPUB   Equalizers &   Event Buses   Exception Handling   Face Recognition   Feedback &   File System   File/Directory   Fingerprint   Floating Action   Fonts   Forms   Fragments   FRP   FSM   Functional Programming   Gamepads   Games   Geocaching   Gestures   GIF   Glow Pad   Gradle Plugins   Graphics   Grid Views   Highlighting   HTML   HTTP Mocking   Icons   IDE   IDE Plugins   Image Croppers   Image Loaders   Image Pickers   Image Processing   Image Views   Instrumentation   Intents   Job Schedulers   JSON   Keyboard   Kotlin   Layouts   Library Demos   List View   List Views   Localization   Location   Lock Patterns   Logcat   Logging   Mails   Maps   Markdown   Mathematics   Maven Plugins   MBaaS   Media   Menus   Messaging   MIME   Mobile Web   Native Image   Navigation   NDK   Networking   NFC   NoSQL   Number Pickers   OAuth   Object Mocking   OCR Engines   OpenGL   ORM   Other Pickers   Parallax List   Parcelables   Particle Systems   Password Inputs   PDF   Permissions   Physics Engines   Platforms   Plugin Frameworks   Preferences   Progress Indicators   ProGuard   Properties   Protocol Buffer   Pull To   Purchases   Push/Pull   QR Codes   Quick Return   Radio Buttons   Range Bars   Ratings   Recycler Views   Resources   REST   Ripple Effects   RSS   Screenshots   Scripting   Scroll Views   SDK   Search Inputs   Security   Sensors   Services   Showcase Views   Signatures   Sliding Panels   Snackbars   SOAP   Social Networks   Spannable   Spinners   Splash Screens   SSH   Static Analysis   Status Bars   Styling   SVG   System   Tags   Task Managers   TDD &   Template Engines   Testing   Testing Tools   Text Formatting   Text Views   Text Watchers   Text-to   Toasts   Toolkits For   Tools   Tooltips   Trainings   TV   Twitter   Updaters   USB   User Stories   Utils   Validation   Video   View Adapters   View Pagers   Views   Watch Face   Wearable Data   Wearables   Weather   Web Tools   Web Views   WebRTC   WebSockets   Wheel Widgets   Wi-Fi   Widgets   Windows   Wizards   XML   XMPP   YAML   ZIP Codes