Tag Archives: NSDateComponents

Converting date into string format in Python, Javascript, Java and Ruby

By | December 30, 2023

Pythonfrom datetime import datetimedate_object = datetime.now()date_string = date_object.strftime(“%Y-%m-%d %H:%M:%S”)print(date_string) JavaScriptconst currentDate = new Date();const dateString = currentDate.toISOString(); // Adjust the format as neededconsole.log(dateString); Javaimport java.text.SimpleDateFormat;import java.util.Date; public class DateToString {public static void main(String[] args) {Date currentDate = new Date();SimpleDateFormat dateFormat = new SimpleDateFormat(“yyyy-MM-dd HH:mm:ss”);String dateString = dateFormat.format(currentDate);System.out.println(dateString);}} Rubyrequire ‘date’current_date = DateTime.nowdate_string = current_date.strftime(‘%Y-%m-%d %H:%M:%S’)puts date_string… Read More »

Contacts Demo in Swift 2 – Showing Contacts Picker, Load Contacts in Custom TableView, Add New Contact, Update Contact, Delete Contact, Search Contact

By | February 23, 2016

In Today’s post I will show you How to do below things in Swift 2… 1. Show Contact Picker using System In-Built UI & Pick a Contact 2. Load all Contacts in a TableView 3. Search a Contact 4. Add a New Contact 5. Update a Contact 6. Delete a Contact Before using the contacts… Read More »

Create a date in your format in IOS

By | December 31, 2014

Below functions takes the current date and time and formats it to give a date-time string. You can customise it in the way you want. The string that the below function generates will be like this – 23-Dec-2014 4:23 PM Use “MMMM” for “December” and “MMM” for “Dec” in month.